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

Bob and Jem and Shelley's Pivot Basket auto-trader
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=658
Page 10 of 28
Author:  phil_trade [ Thu Jul 05, 2012 12:46 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

Steve,

after a backet close, EA enter in sleeping mode. If, for any reason, Empty4 is closed and run again, EA doesn't remender it was sleeping and send another basket.

It will be great to store in GV this sleeping state and read it in init()
Author:  SteveHopwood [ Thu Jul 05, 2012 1:01 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

spotdespot wrote:Steve - you know my MQL coding "skills" are limited so feel free to treat with disdain :lol:

Anyway - there seems to be an issue with BJS when a successful basket is hit and the EA sleeps for whatever time specified (1 minute in my case) when endlessloop = false. What then happens is that BJS opens another basket (as it should if qualified) and then instantly closes it. I "suspect" that it is because the global variables are not being deleted so BJS thinks we have hit our profit target and closes the basket:

Code: Select all

int OldOpenTrades = OpenTrades;
	  CountOpenTrades();
      if (OpenTrades == 0)
      {
         BreakevenAchieved = false;
         GlobalVariableDel(PipsTpGvName);
         GlobalVariableDel(CashTpGvName);
         CloseNeeded = false;
         JslPips = 0;
         JumpingStopPips = 0;
      }//if (OpenTrades == 0)
Is in the endless loop.
I suppose start() is the wrong place for this code anyway. I have left it in place, and copied it to LookForPositionClosure(), which is probably where it belongs. I have also changed the name of the Global Variable, so don't assume the problem has necessarily gone away yet. We shall see.

V 1e in poost 1.

:D
Author:  SteveHopwood [ Thu Jul 05, 2012 1:01 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

phil_trade wrote:Steve,

after a backet close, EA enter in sleeping mode. If, for any reason, Empty4 is closed and run again, EA doesn't remender it was sleeping and send another basket.

It will be great to store in GV this sleeping state and read it in init()
Good idea. I will add this later.

:D
Author:  spyderman [ Thu Jul 05, 2012 1:07 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

Just for informational purposes here's what I get when loaded on ILQ/BBFX and UPFX. Tried to switch all the settings to as liberal as possible.

Thanks,
Author:  feucht [ Thu Jul 05, 2012 2:37 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

2 great trades today, and a net haul of 135 pips. One small issue though, the basket is set to sleep for 90 minutes, and sits there awaiting the time, but once it passes nothing happens. I tried changing the timeframe on the chart it lives on, but it added the 90 minutes to the current time again. This is on 1d with EndlessLoop set to the default of True.

I have readded the EA, set EndlessLoop to False, and it is monitoring pairs again.
Author:  Jemook [ Thu Jul 05, 2012 3:34 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

Yeehaa baby, not a bad EA :D
2012-07-06 01.30.10 am.png
This EA will work amazingly in trending markets. When price closes above and below the daily pivot repeatedly in a range then hopefully the losses we take on it won't be too large and the profits we take on nights like this make up for them. So far looking good.
Author:  garyfritz [ Thu Jul 05, 2012 3:39 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

SteveHopwood wrote:I am not aware of GlobalVariableSet needing a double rather than an integer; indeed, I successfully send integer values to a GV all the time. I have made the change though - no particular reason not to.
The function definition specifies a double value; however MQL should automatically convert ints to doubles when you call it. But it's always a good idea to use the right type and not rely on the language to fix it up for you -- especially with a flaky language like MQL.
Author:  phil_trade [ Thu Jul 05, 2012 4:34 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

garyfritz wrote:
SteveHopwood wrote:I am not aware of GlobalVariableSet needing a double rather than an integer; indeed, I successfully send integer values to a GV all the time. I have made the change though - no particular reason not to.
The function definition specifies a double value; however MQL should automatically convert ints to doubles when you call it. But it's always a good idea to use the right type and not rely on the language to fix it up for you -- especially with a flaky language like MQL.
error message in log was "invalid double number as parameter 2 for GlobalVariableSet function"
but I have not check if GV was filled with the good value...I suppose no.
Author:  phil_trade [ Thu Jul 05, 2012 4:43 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

SteveHopwood wrote
you will find the profit level of a large basket of trades changes rapidly, and it is desirable to have this calculated more often than by waiting for the next tick on the chart hosting bjs
Just to inform :
I have check EURUSD at 19H30 GMT : from 2 ticks / seconds to 1 tick / 3 seconds.
Author:  garyfritz [ Thu Jul 05, 2012 4:44 pm ]
Post subject:  Re: Bob and Jem and Shelley's Pivot Basket auto-trader

"invalid double number" !?

GlobalVariableSet is supposed to take a double. It will accept an int, and in fact the example in the online help uses Bars, which is an int.

But a runtime error of an "invalid" double? That sounds like a non-allowed value, such as NaN (Not a Number). But that seems pretty unlikely...
All times are UTC Page 10 of 28