Alex,
Here is the corrected script. OrderSend is a function which returns a result which u should check.
The basic logic was right bot u forgot the comment field in the OrderSend function. U also put the expiration field to 16.. not sure what that does as I have not tried it before.
Note: this will not work in the backtester as the time function does not seem to return the data's time... this is my interpretation as u get no orders in the backtester.
regards,
hugues
Here is the corrected script. OrderSend is a function which returns a result which u should check.
The basic logic was right bot u forgot the comment field in the OrderSend function. U also put the expiration field to 16.. not sure what that does as I have not tried it before.
Note: this will not work in the backtester as the time function does not seem to return the data's time... this is my interpretation as u get no orders in the backtester.
regards,
hugues
extern double Lots = 0.1; extern double StopLoss = 34; extern double TakeProfit = 17; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { double nlots=0.1,L,H,order; int SC=0,BC=0,cnt=0; for(cnt=0 ;cnt< OrdersTotal(); cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_SELL && OrderSymbol()==Symbol()) BC=1; if (OrderType() == OP_BUY && OrderSymbol()==Symbol()) SC=1; } for(cnt=0 ;cnt< OrdersTotal(); cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); order=OrderTicket(); if (OrderType() == OP_SELLSTOP && OrderSymbol()==Symbol() && SC==1) { OrderDelete(order); } if (OrderType() == OP_BUYSTOP && OrderSymbol()==Symbol() && BC==1) { OrderDelete(order); } } if (Hour() == 15 && Minute() == 00) //EST Hours = 9 { if (OrdersTotal() >0) return; if ((High[1] - Low[1]) < 19*Point) return; L=Low[1]-1*Point; H=High[1]+1*Point; int ticket = OrderSend(Symbol(),OP_SELLSTOP,Lots,L,3,L+StopLoss*Point,L-TakeProfit*Point,"",0,0,Red); // HDB changed - is a function, added comment as "" and removed expiration 16 } if (Hour() == 15 && Minute() == 00) //EST Hours = 9 { if (OrdersTotal() >1) return; if ((High[1] - Low[1]) < 19*Point) return; L=Low[1]-1*Point; H=High[1]+1*Point; ticket = OrderSend(Symbol(),OP_BUYSTOP,Lots,H,3,H-StopLoss*Point,H+TakeProfit*Point,"",0,0,Green); // HDB changed - is a function, added comment as "", removed expiration 16, put as Green } }
BIG THANKS hugues
yw
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
i have problem mit my expert and BuyStop and SellStop Order
BuyStop open and immediately Delete :(
SellStop open and immediately Delete :(
here my Expert code :
help me please