Can anyone help a noob with programming an EA from this indicator?

 

Hi, everyone



second try, the previous post will be deleted.

Well, here's my problem: I am bad at programming and I have this indicator (see attached file), which I would like to automate for trading with. So I was hoping some of you guys out there can help out.

Here's what I want to happen when I run the EA:

it should use the indicator "SimpleEntry" to decide what to do. The indicator colours the bars of the chart in two colours: red and green.

1- Now, when the EA sees a green bar, it should enter a trade (BUY) and do nothing until a red bar appears.

2- As soon as this happens it closes that trade, then enters a new trade (SELL) and holds that until a green bar appears.

3- At this point it will close that trade and we're back to square one.


If that's too simple, maybe you can insert a trailingstop command, for which I can set a value to my liking in the EA's properties.

And here's a tricky question: when I use the EA, do I need to apply the indicator to that chart window? What if I want to change the indicator's settings?


Thanx a million.

 

Looks like this indicator was created with one of those EX4 to MQ4 conversions.

 
irusoh1:

Looks like this indicator was created with one of those EX4 to MQ4 conversions.

Sure looks like it and if you help turning it into an EA you become an accessory to an illegal act.
 

However, it is possible to use an indicator in an EA without engaging in the illegal act of de-compiling the .ex4

From an inspection of the MT4 Data Window I see that there are two buffers. The first step is to get the data in those buffers...

data0[i] = iCustom(NULL,0,"SimpleEntry",5,3,1,5,0,i);
data1[i] = iCustom(NULL,0,"SimpleEntry",5,3,1,5,1,i);
The next step is to get the logic behind green and red bars. It looks like...
if( data0[i]>data1[i] ) color[i]="green" else color[i]="red";

Then there is the logic of how to trade these colors, which is explained by the OP (original poster).

 
No response from OP. I should have remembered Mathew 7:6 "neither cast ye your pearls before swine".
 
engcomp:
No response from OP. I should have remembered Mathew 7:6 "neither cast ye your pearls before swine".
Maybe he's been locked up for decompiling :)
 
Viffer:
Maybe he's been locked up for decompiling :)

Would be a shame. I recompiled the code he/she sent us, then used the compiled version to build an EA that has the following features:

  1. It lets you set the parameters of the SimpleEntry indicator via the external input of the EA. This addresses the question "what if I want to change the settings of the indicator?" There is no need to attach the indicator to the chart window, but it must exist as a compiled version in the custom indicator folder.
  2. It lets you set a switch whether you want to use the current bar as a signal bar. Default is false because the current bar can change its colour several times while it is developing and consequently could trigger a false entry. The price for this is that the next entry, if correct, is short at or near the bottom of the preceding bar or is long at or near the top.
  3. It lets you set a switch whether you want the entry filtered by SAR. Default is false. If set to true, the SAR has to be below the price for buying and above the price for selling.
  4. It trails a stop loss that is the smaller of SAR or a fixed pip distance you specify. The default is 25, which is too close for optimum performance.
  5. It has a profit target you specify, default is 150 pips.
  6. It has a switch to stop trading while the EA is still running. This allows the EA to monitor the exit strategy without taking a new position.
  7. It lets you enter trades manually, which are then monitored by the EA for exit strategy.
  8. It lets you set a time limit after which all positions are closed. Default is 50 bars.
  9. It lets you set a switch to choose between fixed lots or dynamic lot size based on capital and risk percentage.
It would be interesting to find out how much the OP is willing to pay for this EA? (In compiled format of course, decompilation not allowed).
 
engcomp:

Would be a shame. I recompiled the code he/she sent us, then used the compiled version to build an EA that has the following features:

  1. It lets you set the parameters of the SimpleEntry indicator via the external input of the EA. This addresses the question "what if I want to change the settings of the indicator?" There is no need to attach the indicator to the chart window.
  2. It lets you set a switch whether you want to use the current bar as a signal bar. Default is false because the current bar can change its colour several times while it is developing and consequently could trigger a false entry. The price for this is that the next entry, if correct, is short at or near the bottom of the preceding bar or is long at or near the top.
  3. It lets you set a switch whether you want the entry filtered by SAR. Default is false. If set to true, the SAR has to be below the price for buying and above the price for selling.
  4. It trails a stop loss that is the smaller of SAR or a fixed pip distance you specify. The default is 25, which is too close for optimum performance.
  5. It has a profit target you specify, default is 150 pips.
  6. It has a switch to stop trading while the EA is still running. This allows the EA to monitor the exit strategy without taking a new position.
  7. It lets you enter trades manually, which are then monitored by the EA for exit strategy.
It would be interesting to find out how much the OP is willing to pay for this EA? (In compiled format of course, decompilation not allowed).
See now you've gone and peaked my interest.... I was going to take a look at what the iny does but I see OP has been back to the thread to remove the original code. Always fun to play around with this stuff... oh well.
 
Viffer:
See now you've gone and peaked my interest.... I was going to take a look at what the iny does but I see OP has been back to the thread to remove the original code. Always fun to play around with this stuff... oh well.

And have you found any decent backtesting results with it engcomp?
 
Genma:

And have you found any decent backtesting results with it engcomp?

It's a trend-following system with less lag than MA-cross, but suffers whipsaws like all trend systems do.

The overall result was negative. If you attach a filter to avoid whipsaws it would be very good.

For example, if the SAR filter is set to true, the results are break-even with 25 pip trailing stop and positive with 40 pip TS.

If you use the EA just for entry and monitor the exit manually (can't be done in back testing), it is highly profitable.

 

hi, even if the code is removed by the OP the code is still in the database of the forum.

you can change the link of some other post, or if you don't want to guess the original filename you could ask the cache of a search engine ;)