Hi,
I wrote EA's for different pairs. but i like to use only one chart.
Currently i run GBPUSD chart and strategy running for EA on 30min tf. now i add code for USDJPY with 4hr startegy also.
EA not opening buy/sell orders?
i take values from following code by opening GBPUSD chart. why USDJPY orders not opening?
Error:
Please show your OrderSend() call and all the relevant code.
I get values from following code:
some_time=iTime("USDJPY", PERIOD_D1, 0); shift=iBarShift("USDJPY",PERIOD_H4,some_time); Hval=iHigh("USDJPY",PERIOD_H4,shift); Lval=iLow("USDJPY",PERIOD_H4,shift); HLdiff=Hval-Lval;
OrderSend() call:
for (int i=OrdersTotal()-1; i >= 0; i--) if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_BUYSTOP && OrderSymbol() == "USDJPY" && OrderMagicNumber() == 1) { exists = true; } } else { Print("OrderSelect() error - ", ErrorDescription(GetLastError())); }
Please solve the issues?
Note: I do backtesting currently. still not tried with forward test. while backtest i choose different timeframe,pair...
That's OrderSelect, not OrderSend
Anyway, most likely that you are trying to open trades on USDJPY, but using the chart symbol's Ask/Bid
{ int expire = TimeCurrent() + 60 * 480; double price = NormalizeDouble(Hval, NDigits) + PriceOffset*PipValue*Point; double SL = price - BuyStoploss*PipValue*Point; if (BuyStoploss == 0) SL = 0; double TP = price + BuyTakeprofit*PipValue*Point; if (BuyTakeprofit == 0) TP = 0; if (480 == 0) expire = 0; int ticket = OrderSend("USDJPY", OP_BUYSTOP, BuyLots, price, 4, SL, TP, "My Expert", 2, expire, Blue); if (ticket == -1) { Print("OrderSend() error - ", ErrorDescription(GetLastError())); }
What are the value of price,SL,TP and current bid/ask for USDJPY ? You have to print these values to check what happens.
Here is the values found from journal.
2014.04.27 00:15:58.734 2014.04.25 04:00 KULDU GBPUSD,M30: open #10 buy stop 0.10 GBPUSD at 102.60700 sl: 102.60200 tp: 102.61700 ok
double price = NormalizeDouble(Hval, NDigits) + PriceOffset*PipValue*Point;For other pairs you can't use ANY predefines
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I wrote EA's for different pairs. but i like to use only one chart.
Currently i run GBPUSD chart and strategy running for EA on 30min tf. now i add code for USDJPY with 4hr startegy also.
EA not opening buy/sell orders?
i take values from following code by opening GBPUSD chart. why USDJPY orders not opening?
Error:
OrderSend() error - invalid stops