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

My shell EA code
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=79
Page 18 of 23
Author:  Bruster400 [ Tue Oct 20, 2015 2:17 pm ]
Post subject:  My shell EA code

Steve,

I've had a go with the new BareBones and the only thing I've spotted is that in OnTick() you've left

Code: Select all

 if (TicketNo == -1)
rather than the

Code: Select all

 if (OpenTrades < MaxTradesAllowed)
that you'd suggested to me in an earlier post. No big deal, and you do comment that it should be removed for multi-traders but just thought I'd mention it so that people coding for multi-trades don't have to hunt it down.

Bruce

EDIT - just found another minor change that people might want to make. In GetTimeFrameDisplay(int tf) (line 676 BareBones) there are two entries for M15 and both return "M1" rather than "M15". Again, not a big deal and doesn't affect the EA's trading. I'm not trying to pick holes in the code - just trying to help.
Author:  SteveHopwood [ Tue Oct 20, 2015 4:45 pm ]
Post subject:  My shell EA code

Latest versions of the three usual suspects are in post 1.

I decided to do something for our FIFO-blighted US cousins. Ok, so the closure code as was would eventually close out all the trades but it needed calling as many times as there were trades.

Load Bugger All Included into the editor and follow the bookmarks to see what I have done.

I assumed that lower ticket numbers would be older trades, so I declared an array to hold the ticket numbers of all the trades, then sort them in descending order so that the furthest back in time would be at the top of the array, and so on down.

Originally, all this code was within a user input IfLunaticFifoRulesApply and the code was redirected to a dedicated FIFO trade closure function. I realised later that we do not need a separate function because iterating through the array of ticket numbers is going to be more efficient that iterating through all the trades on the platform.

Usage will throw up anything that I have broken during this process.

:xm:
Author:  SteveHopwood [ Mon Feb 08, 2016 12:47 pm ]
Post subject:  My shell EA code

I have uploaded the latest versions of my shells. There are a few amendments, and I have added extra variables for building up a picture of an open position - variables I was finding were needed in addition to those already in place.

semafor looks as though it offers a way of managing basket and hedged positions, so I have added the "Retro-fitting semafor-managed grid hedging.mq4" file to show you how to add this functionality to your own EA's created using my shells.

:xm:
Author:  SteveHopwood [ Sat Feb 20, 2016 12:25 pm ]
Post subject:  My shell EA code

Latest versions of the shells are in post 1.

It looks as though grid trading, hedging and semafor are going to be oft-used features, so I have added them to the shells. Updated user guides are attached as well, along with "3 level". I will re-code the semafor stuff at some point; all the indi does is highlight the hilo of the previous x candles, so it is not rocket science.

I am finding myself increasingly needing to know the highest and lowest prices of baskets of trades, along with open times etc, so I have created groups of variables the CountOpenTrades() will populate automatically - you will see them lined up like little soldiers at the bottom of General Inputs.

:xm:
Author:  SteveHopwood [ Sat Feb 20, 2016 3:54 pm ]
Post subject:  My shell EA code

I just added the lot size calculation from HGB'nG to the shells and updated the user guides.

:xm:
Author:  retireme [ Sun Feb 21, 2016 12:13 am ]
Post subject:  My shell EA code

Thanks Steve, awesome job indeed...

RM
Author:  Jagg [ Wed Mar 09, 2016 4:19 pm ]
Post subject:  My shell EA code

Steve, thank you very much for your shells :good:

What I don't understand are these two lines in the SendSingleTrade() function (line 890 in ShellAutoTradingRobotCode_BareBones_6xx.mq4 for example)

Code: Select all

      if(type == OP_BUY) price = MarketInfo(symbol, MODE_ASK);
      if(type == OP_SELL) price = MarketInfo(symbol, MODE_BID);
When I use the SendSingleTrade function I give my (calculated) price parameter with it. But above two lines "destroys" the given price parameter and set it always back to ask/bid?

Shouldn't it be

Code: Select all

      if((price == 0) && (type == OP_BUY)) price = MarketInfo(symbol, MODE_ASK);
      if((price == 0) && (type == OP_SELL)) price = MarketInfo(symbol, MODE_BID);
or something like that...

ok, forget what I wrote :arrrg: (when price is not at ask/bid we have to use other order types for that...)
Author:  SteveHopwood [ Wed Apr 06, 2016 3:43 pm ]
Post subject:  My shell EA code

Latest versions of the three main shells are in post 1, with fixes for thingies that came up with use.

:xm:
Author:  SteveHopwood [ Sun May 01, 2016 9:20 am ]
Post subject:  My shell EA code

Updates to the three shells that I regularly use are in post 1, with the full offsetting code I am developing elsewhere. I have updated the Shell User Guide. This is an OpenOffice document. This is free and open source software, so do a Google search if yours does not provide the facility to convert documents to pdf format.
Author:  zaguy [ Sun May 01, 2016 9:56 am ]
Post subject:  My shell EA code

Thank you Steve. Much appreciated.
All times are UTC Page 18 of 23