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

Flying Slope auto-trading EA
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=680
Page 24 of 28
Author:  SteveHopwood [ Thu Aug 09, 2012 3:59 pm ]
Post subject:  Re: Flying Slope auto-trading EA

Version 1i is in post 1.

If you enable CloseOnHtfSignal, you are telling FS to close a buy trade if there is a down arrow on the higher time frame chart (vice-versa for a sell). You need a value in the HigherTimeFrame Flying Buddha inputs section. To stop FS from using the Htf FB as part of the trading decision, set UseHigherTimeFrame to false.

Getting this right has been a struggle this afternoon, but it appears to be holding up in strategy tester.

:D
Author:  kwchau [ Fri Aug 10, 2012 2:47 am ]
Post subject:  Re: Flying Slope auto-trading EA

SteveHopwood wrote:Version 1i is in post 1.

If you enable CloseOnHtfSignal, you are telling FS to close a buy trade if there is a down arrow on the higher time frame chart (vice-versa for a sell). You need a value in the HigherTimeFrame Flying Buddha inputs section. To stop FS from using the Htf FB as part of the trading decision, set UseHigherTimeFrame to false.

Getting this right has been a struggle this afternoon, but it appears to be holding up in strategy tester.

:D
Thanks for the quick update, will put it into test with both CloseonHtfSignal and UseHighertimeFrame to false.
Author:  jiaxingx [ Fri Aug 10, 2012 11:15 am ]
Post subject:  Re: Flying Slope auto-trading EA

anybody backtest that ea 1i ?
I have no trade !
Author:  kwchau [ Fri Aug 10, 2012 11:32 am ]
Post subject:  Re: Flying Slope auto-trading EA

jiaxingx wrote:anybody backtest that ea 1i ?
I have no trade !
I have 2 trades opened on demo, gpbaud and usdcad.
Author:  SteveHopwood [ Sat Aug 11, 2012 5:21 pm ]
Post subject:  Re: Flying Slope auto-trading EA

Version 1j is in post 1. Details in 'Rogue' trades and the safety features in post 1.

This is an essential update. I cannot guarantee that the sort of combination of inputs and incorrect coding logic that kwchau highlighted last week might not occur again - if I could so guarantee would imply that I can forsee every possible combination. I cannot. To continue to use an older version of FS is foolish.

That is the polite version, and I find some people resistant to stuff expressed quietly, so here it is a tad more directly.

Only an idiot would continue to use an older version of FS after the events of last week. If you are one-such idiot, then do not come crying to me when FS drains your account. You will not receive any sympathy.

:D
Author:  SteveHopwood [ Sat Aug 11, 2012 5:27 pm ]
Post subject:  Re: Flying Slope auto-trading EA

Re the sparse trading, this is to be expected. Anyone who understands what a Flying Buddha is and has more than a tenuous grasp of what Slope is telling us, will understand that it is not going to be a trading tart - and will understand why. Plus, it is August.

I also have the gbpaud trade on my live account - and it is going nowhere. I do not mind, because the swap is positive. I would be going nuts were it negative. :lol: If the trade does head South as some stage, then great. If not, and it either stays put or heads North, then I will simply treat it as a carry trade and let it earn interest.

:D
Author:  pah [ Sun Aug 12, 2012 5:19 am ]
Post subject:  Re: Flying Slope auto-trading EA

Hi Steve,

Just downloaded this one (1J) out of interest and noticed that it freezes the tester as soon as it opens the first trade (a sell in my case). I'm still looking for possible causes.

I did notice that there is a bug in IsClosedTradeRogue()

Code: Select all

      //Subtract the OrderCloseTime from the OrderOpenTime. There must be a minimum of > MinMinutesBetweenTradeOpenClose minutes between the open and the close. < this indicates possible rogue behaviour.
      if (OrderOpenTime() - OrderCloseTime() < (MinMinutesBetweenTradeOpenClose * 60) )
I think what you wanted to check was OrderCloseTime() - OrderOpenTime()

Also, the break following the test means that once you have found and checked one history trade (with matching magic no, etc) and it's open & close times were OK, then it can exit the loop. However, this assumes that the history trade you found was the very last one closed which may not always be the case since the order of trades is arbitary. Remember a good while back when I sent you some history checking code (it was to find the last closed order) for something that was exhibiting strange behaviour which was down to this issue?

Regards, Paul.
Author:  pah [ Sun Aug 12, 2012 6:06 am ]
Post subject:  Re: Flying Slope auto-trading EA

The freeze on opening a trade appears to be fixed by adding a return value to the following two lines in LookForTradeClosure()

Code: Select all

if (HtfSlopeTrend == buyhold) return(false);

Code: Select all

if (HtfSlopeTrend == sellhold) return(false);
Regards, Paul.
Author:  pah [ Sun Aug 12, 2012 6:21 am ]
Post subject:  Re: Flying Slope auto-trading EA

And now it only trades once which is caused by the check in TooClose()

Code: Select all

if (TimeHour(TimeCurrent()) - TimeHour(OrderCloseTime()) < (MinMinutesBetweenTrades * 60) )
This is checking the hour but could be checking a trade from yesterday for example, which happened to have occurred at an earlier hour.

Also, I'm a bit puzzled by it only checking history here, should it not also be looking at open trades that were taken recently and ensuring it doesn't open another too soon after?

Since it only opens market orders direct (no stop or limit orders) might it not be easier to set a datetime variable called e.g. NextTradeAllowed which you can set when you open a trade ( TimeCurrent() + (MinMinutesBetweenTrades * 60) ) and then disallow any subsequent trades that fire before this time has passed?

Just my thoughts...

Regards, Paul.
Author:  SteveHopwood [ Sun Aug 12, 2012 3:36 pm ]
Post subject:  Re: Flying Slope auto-trading EA

pah wrote:Hi Steve,

Just downloaded this one (1J) out of interest and noticed that it freezes the tester as soon as it opens the first trade (a sell in my case). I'm still looking for possible causes.

I did notice that there is a bug in IsClosedTradeRogue()

Code: Select all

      //Subtract the OrderCloseTime from the OrderOpenTime. There must be a minimum of > MinMinutesBetweenTradeOpenClose minutes between the open and the close. < this indicates possible rogue behaviour.
      if (OrderOpenTime() - OrderCloseTime() < (MinMinutesBetweenTradeOpenClose * 60) )
I think what you wanted to check was OrderCloseTime() - OrderOpenTime()
Nope. The order opened before it closed, so I need to know how soon after its open that it closed.
Also, the break following the test means that once you have found and checked one history trade (with matching magic no, etc) and it's open & close times were OK, then it can exit the loop. However, this assumes that the history trade you found was the very last one closed which may not always be the case since the order of trades is arbitary. Remember a good while back when I sent you some history checking code (it was to find the last closed order) for something that was exhibiting strange behaviour which was down to this issue?

Regards, Paul.
Can you do me a favour, please, and resend me this, or post it here? I don't remember this and it would be most helpful.

:D
All times are UTC Page 24 of 28