EA back tests but does not trade

 

Hi eveyone.

No doubt someone else has come across this sort of problem.

I have an EA that back tests OK, runs optimisations fine but does not trade when attached to a chart. It is not my terminal settings as I have other EAs that are trading fine. I am surprised that it is the EA because it is basically a paste and copy of another EA that works fine, with a couple of adjustments. I have tried to add magic numbers to the new EA and maybe this is where the problem comes from.

What is the proper(simplest) way to allocate magic numbers to a trade.


Thanks


David

 
newton.dj:

Hi eveyone.

No doubt someone else has come across this sort of problem.

I have an EA that back tests OK, runs optimisations fine but does not trade when attached to a chart. It is not my terminal settings as I have other EAs that are trading fine. I am surprised that it is the EA because it is basically a paste and copy of another EA that works fine, with a couple of adjustments. I have tried to add magic numbers to the new EA and maybe this is where the problem comes from.

What is the proper(simplest) way to allocate magic numbers to a trade.

It's most likely this  ECN
 
newton.dj:

Hi eveyone.

No doubt someone else has come across this sort of problem.

I have an EA that back tests OK, runs optimisations fine but does not trade when attached to a chart. It is not my terminal settings as I have other EAs that are trading fine. I am surprised that it is the EA because it is basically a paste and copy of another EA that works fine, with a couple of adjustments. I have tried to add magic numbers to the new EA and maybe this is where the problem comes from.

What is the proper(simplest) way to allocate magic numbers to a trade.


Thanks


David


post your code
 
newton.dj: What is the proper(simplest) way to allocate magic numbers to a trade.

You don't. A magic number is a constant (simplest.) You put it in the OrderSend so later you can identify (OrderSelect loop) which trades belongs to the EA on the current pair.

Your problem is else where. Post your code - there are no mind readers here.

 

OrderSend(Symbol(),OP_SELL, Lot, Bid, slippage, Bid+StopLoss*Point, Bid-TakeProfit*Point, "Sell: MA_cross_PriceMode",OrderMagicNumber(), 0, Red);


This is my OrderSend comand. Am I correct to use OrderMagicNumber() as a parameter?

 
newton.dj:

OrderSend(Symbol(),OP_SELL, Lot, Bid, slippage, Bid+StopLoss*Point, Bid-TakeProfit*Point, "Sell: MA_cross_PriceMode",OrderMagicNumber(), 0, Red);


This is my OrderSend comand. Am I correct to use OrderMagicNumber() as a parameter?


RaptorUK:
It's most likely this  ECN

Did you look at the link ?
 

Yes I did. Thankyou.

I have not seen or used "OrderReliable" before and I have been trying it out in a new EA, it might be a while before I get an EA written using OrderReliable. I thought however that there might be something simpler, like a simple coding error, that I was overlooking. I thought it was a bit strange for the EA to work in back testing and not in trading. It would seem to me that my EA is correctly written if it is recognised and followed in testing.

Thanks for your help,

 
newton.dj:

Yes I did. Thankyou.

I have not seen or used "OrderReliable" before and I have been trying it out in a new EA, it might be a while before I get an EA written using OrderReliable. I thought however that there might be something simpler, like a simple coding error, that I was overlooking. I thought it was a bit strange for the EA to work in back testing and not in trading. It would seem to me that my EA is correctly written if it is recognised and followed in testing.

Thanks for your help,

You don't need to use OrderReliable . . . read a few of the other links . . . all you need to do is OrderSend() with TP & SL = 0.0 then OrderModify() to set the TP & SL.  Obviously you need to test the return valiue of the OrderSend() to make sure t worked and then select the Order, etc, etc.
 
newton.dj:

OrderSend(Symbol(),OP_SELL, Lot, Bid, slippage, Bid+StopLoss*Point, Bid-TakeProfit*Point, "Sell: MA_cross_PriceMode",OrderMagicNumber(), 0, Red);

This is my OrderSend comand. Am I correct to use OrderMagicNumber() as a parameter?


  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. You can NOT use OrderMagicNumber() unless you do a successful OrderSelect(). You can't do that until OrderSend() completes successfully. What part of "magic number is a constant" was unclear? OrderMagicNumber() is a function. replace it with a constant like 20130603
  3. Now read the link about ECN
Reason: