There is a curly bracket missing from the above code. I need to know where you have it.
OrderModify - Error code 1 9 replies
Why ordermodify error 1? 9 replies
OrderModify error 1 HELP PLEASE 5 replies
OrderModify() problem (NOT error code 1) 3 replies
OrderModify error 1 ?? 0 replies
if (OrderSymbol()==Symbol() && OrderType()== OP_SELL) { double BreakEvenSell = OrderOpenPrice() - (BE_Pips*Point); double PP_Pipsell = OrderOpenPrice() - (PP_Pips*Point); double PP_Lotssell = PP_Percent*OrderLots(); if (PartialProfit == true) { if (PP_Pipsell >= Ask && PP_Lotssell > 0.0 && OrderLots() >= 0.2) { OrderClose(OrderTicket(),PP_Lotssell,Ask,MaxSlippage,0); Print ("Partial Profit Taken on Sell",OrderTicket()); } } if (BreakEven == true) { if (BreakEvenSell >= Ask && OrderStopLoss() != OrderOpenPrice()-(BE_AddedPips*Point)) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-(BE_AddedPips*Point),OrderTakeProfit(),0,0); Print ("BreakEven Executed on",OrderTicket()); } } if (OrderStopLoss()> NormalizeDouble(stoploss,4) && RiskManagement==true && OrderStopLoss() != OrderOpenPrice()-(BE_AddedPips*Point)) { OrderModify(OrderTicket(),OrderOpenPrice(),stoploss,OrderTakeProfit(),0,0); } } if (OrderSymbol()==Symbol() && OrderType()== OP_BUY) { double BreakEvenBuy = OrderOpenPrice() + (BE_Pips*Point); double PP_Pipbuy = OrderOpenPrice() + (PP_Pips*Point); double PP_Lotsbuy = PP_Percent*OrderLots(); if (PartialProfit == true) { if (PP_Pipbuy <= Bid && PP_Lotsbuy > 0.0 && OrderLots() >= 0.2) { OrderClose(OrderTicket(),PP_Lotsbuy,Bid,MaxSlippage,0); Print ("Partial Profit Taken on Buy",OrderTicket()); } } if (BreakEven == true) { if (BreakEvenBuy <= Bid && OrderStopLoss() != OrderOpenPrice()+(BE_AddedPips*Point)) { OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+(BE_AddedPips*Point),OrderTakeProfit(),0,0); Print ("BreakEven Executed on",OrderTicket()); } } if (OrderStopLoss()< NormalizeDouble(stoploss1,4) && RiskManagement==true && OrderStopLoss() != OrderOpenPrice()+(BE_AddedPips*Point)) { OrderModify(OrderTicket(),OrderOpenPrice(),stoploss1,OrderTakeProfit(),0,0); } } }
int buytradeok() { int trade=0; //---- for(int f=0;f<OrdersTotal();f++) { if(OrderSelect(f,SELECT_BY_POS,MODE_TRADES)==false) break; if(OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY) { if (OrderOpenPrice() == entry1) trade++; } } } //---- return orders volume if(trade>0)return(1); else return(0); }
if (total < MaxOrders) { if (CalculateBuyOrders()==0 && Close[0]<Var1) { if (buytradeok() < 1) { if (RiskManagement==true) { ticket=OrderSend(Symbol(),OP_BUYSTOP,LotValue,entry1,MaxSlippage,stoploss1,takeprofit1,NULL,0,0,Blue); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES)) Print("BUYSTOP opened : ",OrderOpenPrice()); } else Print("Error opening BUYSTOP order : ",GetLastError()); }
DislikedAs you can see the buystop is the only function that is allowing the 2 equal values to pass through to the statement.Ignored
Dislikedpls find the attached sample EA.
this EA will put buystop at SMA(100) if price below SMA(100), reverse for sell
attached pic show how EA modify open price when SMA change its value. but the modifying doesn't occurs at every tick, because there is limitation in modifying pending orderIgnored
Dislikedhi,
please explain what you meant by envelope (bollinger band?) and jumping stop. a picture will help me understanding the logic.
merdeka!Ignored
extern double Lots=0.1;
int start()
{
double bsline = NormalizeDouble (iEnvelopes(NULL, NULL,1,MODE_SMA,0,PRICE_OPEN,0.1,MODE_UPPER,1),Digits);
double StopLevel=MarketInfo(Symbol(),MODE_STOPLEVEL)*Point;
double ssline = NormalizeDouble (iEnvelopes(NULL, NULL,1,MODE_SMA,0,PRICE_OPEN,0.1,MODE_LOWER,1),Digits);
double Spread=MarketInfo(Symbol(),MODE_SPREAD)*Point;
double Pip = Point;
if(Digits==3 || Digits==5) Pip = 10*Point;
bool res = OrderSelect(0,SELECT_BY_POS);
if(!res)
{
if(Bid<bsline)
{
OrderSend(Symbol(),OP_BUYSTOP,Lots,MathMax(Ask+StopLevel,bsline+Spread),3,ssline,bsline+26*Pip,NULL,0,0,Blue);
}
else
{
OrderSend(Symbol(),OP_SELLSTOP,Lots,MathMin(Bid-StopLevel,ssline),3,bsline,ssline+Spread-26*Pip,NULL,0,0,Red);
}
}
else
{
if(OrderType()==OP_BUYSTOP)
{
if(MathAbs(bsline-OrderOpenPrice())>StopLevel)
{
if(bsline > Ask+StopLevel)
OrderModify(OrderTicket(),bsline,ssline,bsline+26*Pip,0,Yellow);
}
}
else if(OrderType()==OP_SELLSTOP)
{
if(MathAbs(ssline-OrderOpenPrice())>StopLevel)
{
if(ssline < Bid-StopLevel)
OrderModify(OrderTicket(),ssline,bsline,ssline+Spread-26*Pip,0,Yellow);
}
}
}
return;
}
Dislikedpls find the attached sample EA.
this EA will put buystop at SMA(100) if price below SMA(100), reverse for sell
attached pic show how EA modify open price when SMA change its value. but the modifying doesn't occurs at every tick, because there is limitation in modifying pending orderIgnored