Need help making an EA out of a custom indicator

I have this custom indicator which used the iCustom function to call upon other indicators not on the chart. It paints arrows which signals alerts for Buy/Sell/Close. I’m not a programmer, so I’d like an EA which:

  1. enters buy/sell orders as close in time with the indicator’s arrows as possible. (i.e. uses the indicator’s logic and doesn’t waste time analyzing the same data)
  2. enters sl/ts/tp in optional “stealth” mode
  3. ECN-friendly
  4. magic seed

I have an existing EA that’s worked, but I just opened a MB Trading account and it’s getting error 130. Either way, it seems to enter the trades slightly behind the alert from the indicator. I’m also attaching the current EA for this, but just for reference. It keeps getting error 130, and doesn’t place trades. I think it’s due to the stop loss being placed as integers and not price, or MB Trading doesn’t allow stop loss when places trades, so it will need some sort of modify order function??

Error 130 is definitely related to the stop value. I’m not sure what you mean by an integer stop value - that would mean placing stops at 1.0, 2.0, etc. If your code was working on another broker and now doesn’t work, it is quite likely that MBT is an ECN broker (I was too lazy to look it up). The way to fix it is to place the order with SL = 0 and then on the next tick modify the order with the desired SL. Alternatively, you could use a hidden SL and manage the trade within the EA.

With regards to the apparent delay, that is probably caused by the EA waiting for the new bar to open to place the order. Otherwise if it places the order and the indicator repaints, the arrow is no longer there and it would look like an invalid order. That is a problem with most of these trend following indicators and why most fail.

I’ve tried setting SL to 0.0, but it’s still getting error 130. MB Trading is an ECN broker. I’m not a programmer, so I wouldn’t know how to modify or code it for “stealth” mode.

The delay is actually quite minute. Just a few pips under, but I’m using this system on a H1 or H4 chart, so a few pips difference isn’t much.

When I said that the SL must be zero, I meant that the value sent to the server must be 0. Changing the EA value to 0 doesn’t send a 0 to the server. The code needs to be changed to do what I am suggesting.