stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Jem's MACD and SuperTrend trade manager
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5957
Page 1 of 2
Author:  SteveHopwood [ Sun Nov 08, 2020 11:18 am ]
Post subject:  Jem's MACD and SuperTrend trade manager

Jem wanted a multi-pair EA that would close trades when either or both of MACD and SuperTrend move/change in the opposite direction i.e. down/red closes buys and up/green closes sells. This is an EA and so goes in your Experts folder. Make sure that all the pairs you trade are in your PairsToTrade input list.

I coded the manager is such a way that it is easy for competent coders to add their own indi's into the mix. The pdf document explains how.

A couple of extra notes:
The manager will read the indicators when loaded up, for an initial screen display. These will not change again until there are open trades to manage and at the open of a new candle (EveryTickMode = false).

Jem needs a manager that closes trades at the open of each new candle. The EveryTickMode input (fourth one down) tells the manager to work once a second and examine the situation as it is in real time.

:xm: :rocket:
Author:  Jemook [ Mon Nov 09, 2020 5:33 am ]
Post subject:  Jem's MACD and SuperTrend trade manager

Thanks Steve, working brilliantly to manage my positions. Appreciate the effort that went into this!

Cheers
Jeremy
Author:  Pipstubborn [ Mon Nov 09, 2020 3:44 pm ]
Post subject:  Jem's MACD and SuperTrend trade manager

Congratulations Jem and Steve. Looks great and very promising. :cheer: :yahoo:

Pipstubborn/William
Author:  SteveHopwood [ Tue Nov 10, 2020 9:49 pm ]
Post subject:  Jem's MACD and SuperTrend trade manager

A bloop has emerged that should cause an 'array out of range error' and stop the EA from running. Fixed in post 1.

Easy DIY. Do a search for:
//Initialise the bar times to ensure the ea waits for the open of a new candle

The next line of actual code is:
for (int cc = 0; cc <= noOfPairs; cc++)

Remove the '=' from the command, so that it becomes:
for (int cc = 0; cc < noOfPairs; cc++)

:xm: :rocket:
Author:  Jemook [ Wed Nov 11, 2020 5:16 am ]
Post subject:  Jem's MACD and SuperTrend trade manager

Steve-o almighty lord and saviour of the nether realms!

The first version of your EA is still working great and shows the MACD values in the display.
firstversion.png
The latest version I can't seem to get the MACD values in the display.
newversion.png
Attached some screenshots for reference incl. settings.

Please let me know if I'm missing something :)

Cheers
Jem
Author:  SteveHopwood [ Wed Nov 11, 2020 6:55 am ]
Post subject:  Jem's MACD and SuperTrend trade manager

Jemook » Wed Nov 11, 2020 5:16 am wrote:Steve-o almighty lord and saviour of the nether realms!

The first version of your EA is still working great and shows the MACD values in the display.

The latest version I can't seem to get the MACD values in the display.


Please let me know if I'm missing something :)

Cheers
Jem
That is a cpu saver. The manager does not read any values until the open of a new candle when first loaded or if there are no trades open. It would only take a few seconds to add a block of code to OnInit() to take a reading on start up, without looking for any trade closures.

Would you like me to do this?

:xm: :rocket:
Author:  SteveHopwood [ Wed Nov 11, 2020 7:31 am ]
Post subject:  Jem's MACD and SuperTrend trade manager

I decided to add the extra code block anyway. V 1c in post 1. I have also added our old friend EveryTickMode.

Please see the notes added to the bottom of post 1.

:xm: :rocket:
Author:  Jemook [ Wed Nov 11, 2020 12:05 pm ]
Post subject:  Jem's MACD and SuperTrend trade manager

Awesome thank you, I’ll give it a go. This EA is a lifesaver for my trading. As always absolutely solid work form the maestro himself.

Cheers
Jeremy
Author:  Jemook [ Thu Nov 12, 2020 5:34 am ]
Post subject:  Jem's MACD and SuperTrend trade manager

Hey Steve - if you can still be bothered looking into this one read ahead :)

The new EveryTickMode works great to see the values. Thanks!

I'm still getting trades closed out as I open them rather than closing out ONLY on the bar close.

Example.. current MACD bar is green, I go short and it auto-closes the position

Correct functionality would be to not take any action until the bar closes on the specified TradingTimeFrame

Thanks me lord

Cheers,
Jeremy
Author:  SteveHopwood [ Thu Nov 12, 2020 6:01 am ]
Post subject:  Jem's MACD and SuperTrend trade manager

Jemook » Thu Nov 12, 2020 5:34 am wrote:Hey Steve - if you can still be bothered looking into this one read ahead :)

The new EveryTickMode works great to see the values. Thanks!

I'm still getting trades closed out as I open them rather than closing out ONLY on the bar close.

Example.. current MACD bar is green, I go short and it auto-closes the position

Correct functionality would be to not take any action until the bar closes on the specified TradingTimeFrame

Thanks me lord

Cheers,
Jeremy
Not if you have enabled EveryTickMode. Then the manager examines the situation at every tick and compares the close of shift 1 with now. When these are closure conditions then the manager closes the trade.

:xm: :rocket:
All times are UTC Page 1 of 2