Are you on a 5 digit or 4 digit broker ? if you are on a 4 digit broker then your stop is 1 pip and may be too close . . .
What errors are generated when a trade was attempted ? was a trade attempted ? if you don't know this how can you hope to fault find your problem ?
At least do this . . .
// Check for Open if ((nowmain>20) && (b4plusdi<b4minusdi) && (nowplusdi>nowminusdi) && ((mainstoch>signalstoch)||(mainstoch1>signalstoch1) || (mainstoch2>signalstoch2)) && (mainstoch<40)&& (Heiken_op>Heiken_cl) &&(MA9b4<MA9)) //condition {ticket = OrderSend(Symbol(),OP_BUY,LotSize,OpenPrice,2, BuyStopLoss, BuyTakeProfit,0,Green);} Print ("Last error = ", GetLastError()); // <-------------- add this line
if you don't get an error then you need to start looking at the values in your if statement . . .
Because they have different "characteristics" - one EA will not conquer them all.
But it is clear your code has one big problem - it doesn't have any Print() statements.
Code that doesn't have sufficient Print() statements will simply not work. ;-)
Thanks guys for your fast reply!
- You must count down when closing orders in the presence of multiple orders (multiple charts). No magic number makes the EA incompatable with any other including itself on other timeframes.
for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() ){ // and my pair.
- Always test return codes
ticket = OrderSend(Symbol(),OP_BUY,LotSize,OpenPrice,2, BuyStopLoss, BuyTakeProfit,0,Green); if (ticket < 0) Alert("OrderSend failed: ", GetLastError());
- EA's must adjust TP, SL, AND SLIPPAGE for 5 digit brokers. On ECN brokers you must open and THEN set stops.
//++++ These are adjusted for 5 digit brokers. int pips2points; // slippage 3 pips 3=points 30=points double pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits == 5 || Digits == 3){ // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
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
Hello, I just built my first EA, and I tried to test it in the strategy tester. Data is complete, other EA work on the same properties on GBPJPY nad GBPUSD, so I dont understand why isnt my EA working? It turns out that the EA did not open any trades on these pairs, where as it does work correctly on EURUSD pair. Does anybody have any kind of suggestions concerning this problems? Here is the code to my EA, if you had any general comments concerning my EA, please let me know as I am a total newbie, and I would be greatful for any help. Tomek