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

10.7 trading helpers by Steve and others
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3561
Page 9 of 9
Author:  kwchau [ Tue Aug 26, 2014 12:09 pm ]
Post subject:  10.7 trading helpers by Steve and others

SteveHopwood » Thu Jul 17, 2014 2:53 am wrote:
kwchau » Wed Jul 16, 2014 2:31 pm wrote:

It also just comes to my mind that your EA is designed in such a way that it normally will remove itself from the chart once an open trade/ trades are closed. I wonder why this time it did not remove itself after closing the open position/positions and continue to open and close positions.

cheers
It could be that the removal code does not work with the latest platforms. For sure it is redundant as there is now an ExpertRemove() command. Try replacing line 2475 with ExpertRemove()

:xm:
Hi Steve,

It seems that the ExpertRemove() does not solve this rapid opening-closing of trades.

I have had these rapid opening and closing of trades with CADJPY today. It fired about 80 trades before I manually removed the EA. In normal circumstances, the EA should remove itself after an open position is closed. Something must be holding it back from removing itself. Here below is the codes of the EA remove section:

//Find open trades.
CountOpenTrades();
//Safety feature. Sometimes an unexpected concatenation of inputs choice and logic error can cause rapid opening-closing of trades. Detect a closed trade and check that is was not a rogue.
if (OldOpenTrades != OpenTrades && OpenTrades == 0)
{
//EA auto-removal code
ExpertRemove();
}//if (OldOpenTrades != OpenTrades)

OldOpenTrades = OpenTrades;

//Reset various bools
if (OpenTrades == 0)
{

}//if (OpenTrades > 0)

These helper EA's are extremely useful to trade Bob's method. Could you kindly look into this to see whether this problem can be fixed ?
Author:  kwchau [ Tue Sep 09, 2014 2:15 am ]
Post subject:  10.7 trading helpers by Steve and others

SteveHopwood » Mon Aug 11, 2014 5:58 am wrote:
kwchau » Sun Aug 10, 2014 3:05 pm wrote:Hi Steve,

I have been thinking adding codes to your helper EA to close open positions when Stoch 7 reverses direction at bar close on a H4 chart as part of the closing strategy. I am sure this is very easy for you to do but to me it is an impossible job. :?

Could you show me the way how to do this ? I hope you could help me out !

cheers !
There is no way in the world that I am going to remember reading this in the morning. Send me a pm my friend, to remind me to look at this.

:xm:
Hi Steve, first of all I would like to thank you for sending me the codes to achieve the above Stoch reversal exit strategy. I have tested them and it works fine. The only problem is that I could not turn it off after I set the user input of UseStoch7ReverseForExit to "false". The only thing I have changed is to use Stoch7ExitTF instead of TradingTimeFrame. I did so because I use a different time frame for exit.

Could you help to spot where is the problem ?

Code: Select all

//Addition for kwchau. Close the trade on a reversal of Sto7 at the close of the previous candle
      if (UseStoch7ReverseForExit)
      {
         if (OldStoBarTime != iTime(Symbol(), Stoch7ExitTF, 0) )
         {
            OldStoBarTime = iTime(Symbol(), Stoch7ExitTF, 0);
            if (dStochMainClose[1] > dStochMainClose[2])//Remember to change the conditional to > in a sell ea
            {
               CloseThisTrade = true;
            }//if (dStochMainClose[1] < dStochMainClose[2])            
         }//if (OldStoBarTime != iTime(Symbol(), TradingTimeFrame, 0) )`
      }//if (UseStoch7ReverseForExit)
Author:  SteveHopwood [ Tue Sep 09, 2014 11:04 am ]
Post subject:  10.7 trading helpers by Steve and others

kwchau » Tue Sep 09, 2014 2:15 am wrote:
Hi Steve, first of all I would like to thank you for sending me the codes to achieve the above Stoch reversal exit strategy. I have tested them and it works fine. The only problem is that I could not turn it off after I set the user input of UseStoch7ReverseForExit to "false". The only thing I have changed is to use Stoch7ExitTF instead of TradingTimeFrame. I did so because I use a different time frame for exit.

Could you help to spot where is the problem ?

Code: Select all

//Addition for kwchau. Close the trade on a reversal of Sto7 at the close of the previous candle
      if (UseStoch7ReverseForExit)
      {
         if (OldStoBarTime != iTime(Symbol(), Stoch7ExitTF, 0) )
         {
            OldStoBarTime = iTime(Symbol(), Stoch7ExitTF, 0);
            if (dStochMainClose[1] > dStochMainClose[2])//Remember to change the conditional to > in a sell ea
            {
               CloseThisTrade = true;
            }//if (dStochMainClose[1] < dStochMainClose[2])            
         }//if (OldStoBarTime != iTime(Symbol(), TradingTimeFrame, 0) )`
      }//if (UseStoch7ReverseForExit)
Can't see anything in the code. We are discovering that there is some strange platform behaviour over in the FB thread. I suggest that rather than change inputs via F7, make these changes instead by dragging a fresh instance onto the chart.

:xm:
Author:  kwchau [ Sun Sep 14, 2014 2:38 pm ]
Post subject:  10.7 trading helpers by Steve and others

Hi Guys,

I need some directions as to where to find some EA's or script (not sure they are EA or script) to trade based on price crossing one or multiple moving averages. I remembered that I have used this kind of EAs or scripts in the early 10.xx trading. Unfortunately I no longer have copies after my old PC has retired. I have tried to search the forum but to no avail after lengthy search.

Appreciate any one can help me !

cheers,
kwchau
Author:  KapguHaJI [ Sat Nov 15, 2014 7:22 am ]
Post subject:  10.7 trading helpers by Steve and others

SteveHopwood » Sun May 18, 2014 1:01 am wrote:
kwchau » Fri May 16, 2014 11:49 am wrote:Here are my test results so far on H1 charts:

For the buy or sell twice trend EAs, there is no waiting time to execute an entry, everything seems fine.

For the single entry trend EAs, the entry still has problem but I think I have figured it out . I used the default waiting time of 2 minutes before taking a trade. If the waiting time finished on the same bar, the trade would be entered correctly. If the waiting time was beyond the current bar, i.e., a new bar formed before the 2 minutes waiting time was up, the EA reset everything at the new bar opening. For example, if price broke stoch 10 one minute before bar close, when the new bar started, everything will be reset. Since at that time, the price has already passed Stoch 10, the EA would wait until price broke the Stoch 30 threshold.

I do not trade counter trend trade, so I haven't tested them but I believe the logic would be the same.
The EA's decide there is a trade to be taken, then go into a loop that examines the Sto7 for a retreat into an untradable area for however long you chose the waiting time to be. If Sto7 retreats at any point, the trade is cancelled. If not, the ea proceeds to attempt to take the trade on exit from the loop.

If the trade attempt fails, then the ea resumes normal activity. If conditions are still correct for a trade, it starts the cycle again. If not, there is no further attempt to trade.

The Sto7 can scream up and down like an elevator on acid. On the charts and if at the close of the candle, it is the same value as it was at the candle open, in retrospect it will look as though the thing has not moved for the entire 4 hours - yet it might have opened and closed several trades.

That is the downside of using 'confirmation' delays with an indi as sensitive as those being used here. We might not get what we assumed we would get from looking back in time. Bob says he trades when everything else is in place and Sto7 crosses appropriately. He does not await 'confirmation' stuff like 'remained above for x period of time' or 'wait for the candle to close' etc

You might be barking at the wrong moon with all this. Not saying you are, just suggesting you might be.

:xm:

:xm:
Hello Steve and everyone.

I looked into this and have to say, that though the moon was the wrong one, the problem still exists. It is not in the loop that examines the Sto7, but in the way stochastic itself behaves. When a new bar starts, the 7-bar range on which it is calculated shifts one bar to the right. This sometimes causes the line to jump over the threshold immediately. Then the ReadIndicatorValues() function detects a new M5 bar and decides to renew the "previous" value of Sto7. Both previous and current values appear to be the same, so no cross is detected.

I think that changing this line

Code: Select all

if (!EveryTickMode) dStochMain[1]=GetStochastic(Symbol(),0,KPeriod,DPeriod,Slowing,Method,Price,MODE_MAIN,shift + 1);
into this

Code: Select all

if (!EveryTickMode || iTime(NULL,TradingTimeFrame,0) == iTime(NULL,1,0)) dStochMain[1]=GetStochastic(Symbol(),0,KPeriod,DPeriod,Slowing,Method,Price,MODE_MAIN,shift + 1);
should do the trick. It takes the Sto7 value from the previous bar, if the current one has just opened.

Logically I'm not sure if the cross as a result of a change in parameters rather than price movement should really count. In extreme cases the line can jump from 10 straight to 90, which would cause a fast open/close and self-destruction. Some additional check may be required just in case.

But it is a cross nevertheless. 1 or 2 profitable trades were not taken yesterday on my demo because of this.

Cheers!
All times are UTC Page 9 of 9