TP an SL added.
EU H1.
SL=312; TP=256; Step=110; FirstLot=0.24; IncLot=0.08; MinProfit=450; Magic=2008.
Total net profit : 112.17%
MDD : 28.80%
TP an SL added.
EU H1.
SL=312; TP=256; Step=110; FirstLot=0.24; IncLot=0.08; MinProfit=450; Magic=2008.
Total net profit : 112.17%
MDD : 28.80%
Hi!
My backtest:
Period: 2005.01.01 - 2008 (current days)
Setup: Step = 120, FirstLot = 1, Inclot = 0, MinProfit = 10, Magic = 2008
![]()
Trading forex risk disclaimer. Exclusive EAs in the Elite section.
Trading forex risk disclaimer. Exclusive EAs in the Elite section.
Bring in a code, please, ТР and SL, it is one more excellent variant of the adviser from stop order. Thanks.
#property link "waddahattar@hotmail.com"
extern int Step=120;
extern double FirstLot=0.1;
extern double IncLot=0;
extern double MinProfit=450;
extern int Magic = 2009;
extern string comment="Win";
int order_buy=0;
int order_sell=0;
double eLotSell=0;
double eLotBuy=0;
double gLotSell=0;
double gLotBuy=0;
double LSP,LBP;
double CurrentProfit;
int init()
{
Comment("Waddah Attar REV 1.2");
return(0);
}
int deinit()
{
Comment("");
return(0);
}
int start()
{
CurrentProfit=GetOrdersProfit(Magic);
if (CurrentProfit>=MinProfit)
{
DeletePendingOrders(Magic);
CloseOrders(Magic);
}
if (MyOrdersTotal(Magic)==0)
{
OrderSend(Symbol(),OP_SELLSTOP,FirstLot,Bid-Step*Point,3,0,0,comment,Magic,0,Red);
OrderSend(Symbol(),OP_BUYSTOP,FirstLot,Ask+Step*Po int,3,0,0,comment,Magic,0,Blue);
}
LSP=GetLastSellPrice(Magic);
LBP=GetLastBuyPrice(Magic);
if((Bid-LSP)<=5*Point)
{
OrderSend(Symbol(),OP_SELLSTOP,gLotSell+IncLot,LSP-Step*Point,3,0,0,comment,Magic,0,Red);
}
if((LBP-Ask)<=5*Point)
{
OrderSend(Symbol(),OP_BUYSTOP,gLotBuy+IncLot,LBP+S tep*Point,3,0,0,comment,Magic,0,Blue);
}
Comment("Waddah Attar REV 1.2",
"\n\n\n\n", " CurrentProfit = ", DoubleToStr(CurrentProfit,2),
"\n\n", " Buy Lots = ", DoubleToStr(eLotBuy,2) + " / " + order_buy,
"\n\n", " Sell Lots = ", DoubleToStr(eLotSell,2) + " / " + order_sell);
return(0);
}
int DeletePendingOrders(int Magic)
{
int total = OrdersTotal();
for (int cnt = total-1 ; cnt >= 0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && OrderType()!=OP_BUY && OrderType()!=OP_SELL)
{
OrderDelete(OrderTicket());
}
}
return(0);
}
int CloseOrders(int Magic)
{
int total = OrdersTotal();
for (int cnt = total-1 ; cnt >= 0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol())
{
if (OrderType()==OP_BUY)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3);
}
if (OrderType()==OP_SELL)
{
OrderClose(OrderTicket(),OrderLots(),Ask,3);
}
}
}
return(0);
}
int MyOrdersTotal(int Magic)
{
int c=0;
eLotBuy=0; eLotSell=0;
order_buy=0; order_sell=0;
int total = OrdersTotal();
for (int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY) { eLotBuy=eLotBuy+OrderLots(); order_buy++; }
if(OrderType()==OP_SELL) { eLotSell=eLotSell+OrderLots(); order_sell++; }
c++;
}
}
return(c);
}
double GetLastBuyPrice(int Magic)
{
int total=OrdersTotal()-1;
for (int cnt = total ; cnt >=0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUYSTOP || OrderType()==OP_BUY))
{
gLotBuy=OrderLots();
return(OrderOpenPrice());
}
}
return(0);
}
double GetLastSellPrice(int Magic)
{
int total=OrdersTotal()-1;
for (int cnt = total ; cnt >=0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_SELLSTOP ||OrderType()==OP_SELL))
{
gLotSell=OrderLots();
return(OrderOpenPrice());
}
}
return(100000);
}
double GetOrdersProfit(int Magic)
{
double gProfit=0;
int total=OrdersTotal()-1;
for (int cnt = total ; cnt >=0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUY || OrderType()==OP_SELL))
{
gProfit=gProfit+OrderProfit();
}
}
return(gProfit);
}
#property link "waddahattar@hotmail.com"
extern int Step=120;
extern double FirstLot=0.1;
extern double IncLot=0;
extern double MinProfit=450;
extern int Magic = 2009;
extern string comment="Win";
int order_buy=0;
int order_sell=0;
double eLotSell=0;
double eLotBuy=0;
double gLotSell=0;
double gLotBuy=0;
double LSP,LBP;
double CurrentProfit;
int init()
{
Comment("Waddah Attar REV 1.2");
return(0);
}
int deinit()
{
Comment("");
return(0);
}
int start()
{
CurrentProfit=GetOrdersProfit(Magic);
if (CurrentProfit>=MinProfit)
{
DeletePendingOrders(Magic);
CloseOrders(Magic);
}
if (MyOrdersTotal(Magic)==0)
{
OrderSend(Symbol(),OP_SELLSTOP,FirstLot,Bid-Step*Point,3,0,0,comment,Magic,0,Red);
OrderSend(Symbol(),OP_BUYSTOP,FirstLot,Ask+Step*Po int,3,0,0,comment,Magic,0,Blue);
}
LSP=GetLastSellPrice(Magic);
LBP=GetLastBuyPrice(Magic);
if((Bid-LSP)<=5*Point)
{
OrderSend(Symbol(),OP_SELLSTOP,gLotSell+IncLot,LSP-Step*Point,3,0,0,comment,Magic,0,Red);
}
if((LBP-Ask)<=5*Point)
{
OrderSend(Symbol(),OP_BUYSTOP,gLotBuy+IncLot,LBP+S tep*Point,3,0,0,comment,Magic,0,Blue);
}
Comment("Waddah Attar REV 1.2",
"\n\n\n\n", " CurrentProfit = ", DoubleToStr(CurrentProfit,2),
"\n\n", " Buy Lots = ", DoubleToStr(eLotBuy,2) + " / " + order_buy,
"\n\n", " Sell Lots = ", DoubleToStr(eLotSell,2) + " / " + order_sell);
return(0);
}
int DeletePendingOrders(int Magic)
{
int total = OrdersTotal();
for (int cnt = total-1 ; cnt >= 0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && OrderType()!=OP_BUY && OrderType()!=OP_SELL)
{
OrderDelete(OrderTicket());
}
}
return(0);
}
int CloseOrders(int Magic)
{
int total = OrdersTotal();
for (int cnt = total-1 ; cnt >= 0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol())
{
if (OrderType()==OP_BUY)
{
OrderClose(OrderTicket(),OrderLots(),Bid,3);
}
if (OrderType()==OP_SELL)
{
OrderClose(OrderTicket(),OrderLots(),Ask,3);
}
}
}
return(0);
}
int MyOrdersTotal(int Magic)
{
int c=0;
eLotBuy=0; eLotSell=0;
order_buy=0; order_sell=0;
int total = OrdersTotal();
for (int cnt = 0 ; cnt < total ; cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY) { eLotBuy=eLotBuy+OrderLots(); order_buy++; }
if(OrderType()==OP_SELL) { eLotSell=eLotSell+OrderLots(); order_sell++; }
c++;
}
}
return(c);
}
double GetLastBuyPrice(int Magic)
{
int total=OrdersTotal()-1;
for (int cnt = total ; cnt >=0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUYSTOP || OrderType()==OP_BUY))
{
gLotBuy=OrderLots();
return(OrderOpenPrice());
}
}
return(0);
}
double GetLastSellPrice(int Magic)
{
int total=OrdersTotal()-1;
for (int cnt = total ; cnt >=0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_SELLSTOP ||OrderType()==OP_SELL))
{
gLotSell=OrderLots();
return(OrderOpenPrice());
}
}
return(100000);
}
double GetOrdersProfit(int Magic)
{
double gProfit=0;
int total=OrdersTotal()-1;
for (int cnt = total ; cnt >=0 ; cnt--)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol()==Symbol() && (OrderType()==OP_BUY || OrderType()==OP_SELL))
{
gProfit=gProfit+OrderProfit();
}
}
return(gProfit);
}