| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Slopey Slope https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=745 |
Page 3 of 9 |
| Author: | SteveHopwood [ Wed Aug 15, 2012 9:19 pm ] |
| Post subject: | Re: Slopey Slope |
Fabulous Guido, thanks. This sort of thing is why I make my code so freely available. Guys, Guido has picked up on some muddled thinking on my part. SS only trades at the start of a new candle, yet examines the angle now and compares it with that at the close 1 candle ago. Clearly, it should be comparing the angle at the close of the previous candle with that of two candles ago. Version 1a in post 1 fixes this. I am tired and have done quite a lot of coding again today, so I do not promise the code is correct yet. Thanks Guido. |
|
| Author: | hilavoku [ Thu Aug 16, 2012 9:36 am ] |
| Post subject: | Re: Slopey Slope |
My pleasure to contribute a little bit back to you / the forum. sleep well Guido PS: i see i'am a little bit late with my wishing for a good night |
|
| Author: | hilavoku [ Thu Aug 16, 2012 10:54 am ] |
| Post subject: | Re: Slopey Slope |
Hi Steve, me again. I looked at your new Slopey Slope EA and specially the function 'ReadIndicatorValues' . Code: Select all Did you took a look on my modified version? I don't understand the current one. You define the static variable OldBarTime within the function. So the value of it is 0. Then without setting a value to it you compare OldBarTime with the open time of the current higher timeframe candle. This should always give as a result 'true'. You also calculate the slope of the last closed bar even if there is no new closed bar. So for example in the H4 TF you calculate every tick the same slope value for the last closed bar. Same applies for the lower timeframe. I did also look at 'Flying Slope' EA . There its nearly the same... In my opinion we should add an 'OldBarTime' variable for every timeframe we use. (Htf and Ltf). What do you think? Did i miss the point greetz from sunny germany Guido |
|
| Author: | SteveHopwood [ Thu Aug 16, 2012 9:53 pm ] |
| Post subject: | Re: Slopey Slope |
I am happy for the ea to take a trade on load up if the conditions are in place. At the end of the function, OldBarTime = iTime(NULL, HtfTimeFrame, 0); prevents a further examination of the indi until the start of a new candle. Given that the ea can only look for a new trade at the start of a new candle, this is irrelevant and is a throw back to every-tick trading. |
|
| Author: | hilavoku [ Fri Aug 17, 2012 8:36 am ] |
| Post subject: | Re: Slopey Slope |
Hi Steve, so i read the MQL4 Manual again I don't want to bother you and steal you some valuable time but i do think there are errors in the 'ReadIndikatorValues' function. Perhaps there is someone else who can help me Here we go: I understand the global variable OldBarsTime . Whenever the TradingTimeFrame is reached or there was an error in taking a trade you call 'ReadIndicatorValues' and set OldBarsTime to the acual TradingTimeFrame. I didn't saw this before and it makes sence and works perfect. Now the difficult part i can't get around. Example: higher timeframe Htf = D1 lower timeframe Ltf = H1 TradingTimeFrame = H4 So when there is no error every four hours you call 'ReadIndicatorValues'. So far so good... What does the function at those moments? For the higher time frame it calculates every four hours the 'HtfSlopeVal' which it should do only once in a day For the lower time frame you do the same. This time its not the big problem cause the Ltf is 'lower' then the TradingTimeFrame. (When you look after four hours after some trading opportunities, since then the value of the lower time frame variables have changed three times.) But there can be settings where this could not be true (TradingTimeFrame is lower then Ltf) ... The value of 'PrevLtfSlopeVal' will be set when the 'OldBarTime' is different to iTime(NULL, HtfTimeFrame, 0) . But this does mean that only once in a day the value of the lower time frame will be updated. (At this moment 'OldBarTime' represent 00:00 at some day x. The value won't change until 00:00 on day x+1 . ) So the value 'PrevLtfSlopeVal' is a maximum of 11 hours old even when you call the function every four hours. So i think again there is a need of a OldBarTime variable for the two time frames... Hope you won't be upset and that i'am not the fool whose brain is to small to understand sincerely yours Guido |
|
| Author: | SteveHopwood [ Fri Aug 17, 2012 10:42 pm ] |
| Post subject: | Re: Slopey Slope |
To be honest Guido, I have not the faintest idea what you are talking about. Not that it really matters. Any form of bar time I use is intended to cut down on pcu use. Here, Slope values are calculated internally, so I could simply leave everything to be calculated at every tick and this would not do any harm. Here is why I try to avoid calling custom indicators. It is a copy of a doc I created a long time ago to illustrate the disadvantage of using them in EA's: "The biggest problem with custom indis is one that lies at the heart of Empty4. When an EA consults an indicator, the platform loads it into memory, then unloads it again once it has responded to the EA call. This takes time. Custom indis typically consist of a number of calls to the regular indicators that ship with Empty4, and manipulate the information thus gleaned according to what the coder requires. An indicator such as AllAverages will make a number of calls to standard indicators at each tick; each indi is loaded, used, then unloaded. This takes a long time. Ridiculous, but that is how it works, and is the reason that indis such as AA and VQ slow your machine. And then, we put the EA on multiple charts................................. " My Slope bots do not call custom indies, and so do not subject the cpu to the kind of hammering I describe above. So it does not matter if the occasional bar time call is not quite correct. Ok, so from a purist/perfectionist point of view, it matters. And, I prefer to have accurate code rather than slightly faulty code. Having said that, if the choice is between me spending a day hunting down a tiny and irrelevant bug, or the same day coding a couple of potentially profitable ea's, I am clear where my priorities lie. It helps that I am neither a perfectionist of a purist. 'If it ain't bust then don't fix it' is something I learned long ago, from grim and bitter experience of fixing things until they broke. It takes a lot to drag me down that route these days. Equally, if it is bust and you have fixed it, then please post it here in a form that I can simply download, adopt and then upload to post 1 as the next version. |
|
| Author: | hilavoku [ Sat Aug 18, 2012 11:42 am ] |
| Post subject: | Re: Slopey Slope |
Hi Steve, i totally agree with the statement : 'never change a running system' . :!: When you say the cpu load of an integrated indi can be neglected than it's okay. I haven't checked this. But the changes to be made are not that much and i think you can use those in many other EA's... The second thing i mentioned was about the calculation of the variable 'PrevLtfSlopeVal' . In the 'start' function i added the following line: Code: Select all
As you can see the value of 'PrevLtfSlopeVal' doesn't change within those 24 hours. But it should change like 'LtfSlopeVal' does. So this is a faulty calculation and therefore also the angle of the slope. I did the needed changes and the output now looks like this:
So now both values are changing every trading timeframe and showing the last values from 1*15 min and 2*15 (30) min before. As it should be. The attachment is the modified version. Would be nice if someone also can take a look into the code... happy weekend Guido PS: Harry45 got a version of slopeyslope from me which also includes the difference between two slope values and when a threshold is reached it takes a trade. The modifications i did now are also included in this EA and he says that there are no errors and seems to function the right way... |
|
| Author: | Zypip [ Mon Aug 20, 2012 7:24 am ] |
| Post subject: | Re: Slopey Slope |
Hi there, Just tried your version of the Slopeyslope and opened 20 sell trades when many of the pairs' slope I am watching were actually rising Cheers, Zyp |
|
| Author: | hilavoku [ Mon Aug 20, 2012 7:43 am ] |
| Post subject: | Re: Slopey Slope |
Thanks for the feedback Zyp. I just changed some lines in the 'ReadIndicatorValues' function. Even when Steve's version seems to work at the moment it calculates the wrong values as i stated above. This doesn't also mean that my version is 100% right :-| Also personally i think that the information about the TMA rising or falling is not that meaningful. The difference between the current TMA and the previous TMA could be as little than 0.001. But on this information and the TMA value itself, i don't think you can say; 'okay the TMA is rising i go for long'. I think we should add an additionally threshold for the minimum difference between those two values as i said some post's before. But this is another story... I found a copy and paste thingy. So it would be nice if you give it another try... (attachment updated in above post) thx in advance Guido |
|
| Author: | Zypip [ Mon Aug 20, 2012 7:56 am ] |
| Post subject: | Re: Slopey Slope |
Thanks Guido, not home at the mo but will try later today and report. Cheers, Zyp EDIT: tried the new version but still only sell trades open |
|
| All times are UTC | Page 3 of 9 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|