CSP!





//+------------------------------------------------------------------+
//|                                                    CSP by Maloma |
//+------------------------------------------------------------------+

#include <stdlib.mqh>
#include <stderror.mqh>

extern double Lots=0.1;
extern int    ATR=15;
extern int    P1=16;
extern int    P2=45;
extern int    P3=19;
extern int    P4=50;
       int    magic=149521;        
       

       double BuyLev;
       double BuyLevTP;
       double BuyLevSL;
       double SelLev;
       double SelLevTP;
       double SelLevSL;
        
bool exist()
{
  bool is=true;
  for (int i=0;i<OrdersTotal();i++)
    {
     OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
     if ((OrderSymbol()==Symbol())&&(OrderMagicNumber()==magic)) {is=false;}
    }
return(is);
}

int OpenOrders()
{
  OrderSend(Symbol(),OP_BUYSTOP,Lots,BuyLev,3,BuyLevSL,BuyLevTP,NULL,magic,0,CLR_NONE);
  OrderSend(Symbol(),OP_SELLSTOP,Lots,SelLev,3,SelLevSL,SelLevTP,NULL,magic,0,CLR_NONE);
  return(0);
}

int start()
{ 
  if ((Hour()==11)&&(Minute()==1)&&exist())
    {
     double B4=iOpen(Symbol(),PERIOD_H1, 1);
     double C4=iClose(Symbol(),PERIOD_H1, 1);
     int D4=MathAbs(iATR(Symbol(),PERIOD_H1,ATR, 1)/Point);
     int I4=MathAbs((B4-C4)/Point);
     if (D4<P1) {double E9=D4*3;} else {E9=D4;}
     if (D4*3>P2) {double F9=P2*Point;} else {F9=D4*3*Point;}
     double G9=E9*Point;
     if (I4>P4)
       {
        BuyLev=G9+C4;
        BuyLevTP=BuyLev+P3*Point;
        BuyLevSL=BuyLev-F9;
        SelLev=C4-G9;
        SelLevTP=SelLev-P3*Point;
        SelLevSL=SelLev+F9;
       }
     else
       {
        double B9=(B4+C4)/2;
        BuyLev=NormalizeDouble((B9+G9),Digits);
        BuyLevTP=BuyLev+P3*Point;
        BuyLevSL=BuyLev-F9;
        SelLev=NormalizeDouble((B9-G9),Digits);
        SelLevTP=SelLev-P3*Point;
        SelLevSL=SelLev+F9;
       }
     OpenOrders();
    }
  return(0);
}



Sample





Analysis



Market Information Used:

Series array that contains open prices of each bar
Series array that contains close prices for each bar


Indicator Curves created:


Indicators Used:

Indicator of the average true range


Custom Indicators Used:

Order Management characteristics:
Checks for the total of open orders

It automatically opens orders when conditions are reached

Other Features:

BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-04-01 to 2010-04-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-05-01 to 2010-05-31 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-06-01 to 2010-06-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-02-27 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDCAD on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

Request Backtest for CSP!


From : (yyyy/mm/dd) To: (yyyy/mm/dd)

Pair: Period: