I have tried
double PreviousTick=0.0; double Sellprice=Bid; if(Sellprice < PreviousTick -Distance*MyPoint*Point) { ticket=OrderSend (Symbol(),OP_SELL,Lots,Bid,1,Bid+StopLoss*MyPoint*Point,Bid-TakeProfit*MyPoint*Point,"Sell Order",MagicNumber,0,Red); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); } else Print("OrderSend placed successfully"); }
But still not working
I have tried
But still not working
Try this:
static double PreviousTick=0.0; double Sellprice=Bid; if(Sellprice < PreviousTick -Distance*MyPoint*Point && PreviousTick>0) { ticket=OrderSend (Symbol(),OP_SELL,Lots,Bid,1,Bid+StopLoss*MyPoint*Point,Bid-TakeProfit*MyPoint*Point,"Sell Order",MagicNumber,0,Red); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); } else Print("OrderSend placed successfully"); } PreviousTicke = Sellprice;
My head Hurts Now
sellprice=iOpen(NULL, 0, 0)-Distance*MyPoint*Point; double ask=NormalizeDouble((Ask),5); double bid=NormalizeDouble((Bid),5); double sellprice=NormalizeDouble((sellprice),5); double over=((sellprice)/1); GlobalVariableSet("over",over); if(GlobalVariableGet("over")>=(Ask)) { ticket=OrderSend (Symbol(),OP_SELL,Lots,Bid,1,Bid+StopLoss*MyPoint*Point,Bid-TakeProfit*MyPoint*Point,"Sell Order",MagicNumber,0,Red); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); } else Print("OrderSend placed successfully"); }
Still Not working, no response no nonthing
Can someone Please Help me on what I am doing wrong on my code. I want to open a trade once price goes X number of pips above or below Ask/Bid.
My Code Below is not opening trades and returns no error
The code can only do open order with SELLLIMIT/SELLSTOP or BUYLIMIT/BUYSTOP (Pending Order)
Variable ticket should boolean variable.
The code can only do open order with SELLLIMIT/SELLSTOP or BUYLIMIT/BUYSTOP (Pending Order)
Variable ticket should boolean variable.
But I do not want to use pending Orders, I could have just use them and saved myself from this headache, So you are saying this can no be done?
The reason I want to code this is that I currently using pending orders with spread filter so I use this to filter spread
//+------------------------------------------------------------------+ //|If Spread increase Delete Orders | //+-----------------------------------------------------------Ndumiso+ if (Spread>MaxSpread) { for (a=total-1; a >=0; a--) { OrderSelect(a,SELECT_BY_POS,MODE_TRADES); coment=OrderComment(); par=StringSubstr(coment,0,6); if(OrderType()==OP_SELLSTOP) { OrderDelete(OrderTicket()); Print("Deleting SELL_STOP"," Ordertype:",OrderType()); return; } if(OrderType()==OP_BUYSTOP) { OrderDelete(OrderTicket()); Print("Deleting BUY_STOP"," Ordertype:",OrderType()); return; } }
But I find it not reliable
Is there a reason why Bid can not be < than my sellprice?
sellprice=iOpen(NULL, 0, 0)-Distance*MyPoint*Point; sellprice=NormalizeDouble(sellprice,Digits); if(sellprice>Bid) { ticket=OrderSend (Symbol(),OP_SELL,Lots,Bid,1,Bid+StopLoss*MyPoint*Point,Bid-TakeProfit*MyPoint*Point,"Sell Order",MagicNumber,0,Red); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); } else Print("OrderSend placed successfully"); }
Because if i say
if(sellprice<Bid)
Orders are opened but not the other way around. Is there a logic reason behind this?
Is there a reason why Bid can not be < than my sellprice?
Because if i say
Orders are opened but not the other way around. Is there a logic reason behind this?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Can someone Please Help me on what I am doing wrong on my code. I want to open a trade once price goes X number of pips above or below Ask/Bid.
My Code Below is not opening trades and returns no error