| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Flying Slope auto-trading EA https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=680 |
Page 26 of 28 |
| Author: | garyfritz [ Tue Aug 28, 2012 5:08 am ] |
| Post subject: | Re: Flying Slope auto-trading EA |
A simpler way to control these runaway trades is to enter only on a state change instead of a state. E.g. if you say "buy if I'm currently flat and bid > X," that opens the trade OK. But if some condition causes your EA to close it and bid is still > X, boom it's going to buy again. And sell again and buy again and sell again and ... "bid > X" is a state. It's true for a long time. You probably want to enter only when that state CHANGES from <= X to >X. So if instead you say something like "buy if I'm currently flat, and bid > X, and the LAST bid was <= X" -- then that only happens when the condition is first satisfied. When your exit code closes the trade, it doesn't open it again. (Yeah, welcome back George!!) |
|
| Author: | SteveHopwood [ Tue Aug 28, 2012 10:19 am ] |
| Post subject: | Re: Flying Slope auto-trading EA |
Gary, I learn from you nearly every time you post. I love this idea. In this context, I haven't a clue what thingies state to examine, so I shall devote some bath-time to it. |
|
| Author: | gaheitman [ Tue Aug 28, 2012 11:58 am ] |
| Post subject: | Re: Flying Slope auto-trading EA |
Gary is correct, that is the better way to go. If you are examining the trading conditions in a discrete fashion (opening of every bar) you just need to keep track of the results of your evaluation. Below is some code I used when I coded my first EA using your framework. No doubt I put things in the wrong place, but it still illustrates the points. In this code I am looking for the direction of an MA cross and the GANN Hi-Lo to be in agreement. The code starts by saving the results of this evaluation from the last time I called the function into PreviousDirection. Then I do my check and save it into CurrentDirection. I only trigger the trade (setting LookingForBuy or LookingForSell to true) if CurrentDirection != PreviousDirection. Code: Select all If you are evaluating the trading conditions continuously (every tick) you'll have to impose some sort of waiting period between trades. Since many indicators use the close of the bar, there is a chance that your state will change back and forth with every tick. George |
|
| Author: | garyfritz [ Tue Aug 28, 2012 8:04 pm ] |
| Post subject: | Re: Flying Slope auto-trading EA |
Glad you like it, Steve. Enjoy your bath. And even the state-change idea I posted can have problems, e.g. if the bid oscillates above/below/above/below your entry price. It might be better to use state variables, so when you want to set up an entry, you set GoLong = true. Then your test is "if (GoLong and bid > X) { [[buy]]; GoLong = false; } Then you're sure you'll only enter once. I think that might have been how George used his LookingForBuy var? |
|
| Author: | gaheitman [ Tue Aug 28, 2012 8:26 pm ] |
| Post subject: | Re: Flying Slope auto-trading EA |
Yep, that's exactly how I used it, though in this case the trigger was price exceeding the prior bar's high. From LookForTradingOpportunities(): Code: Select all |
|
| Author: | SteveHopwood [ Fri Aug 31, 2012 11:11 pm ] |
| Post subject: | Re: Flying Slope auto-trading EA |
Hehe. Let me know if you two geniuses come to any firm, usable conclusions. By 'usable', I mean usable by a dimwit like me. I rarely understand a word of what you two write. You bring the term 'High level language' to a whole new level of meaning. |
|
| Author: | gaheitman [ Sat Sep 01, 2012 12:47 am ] |
| Post subject: | Re: Flying Slope auto-trading EA |
I'll take a look-see over the long US weekend and see if I can add something.... No promises. George |
|
| Author: | Mike [ Wed Sep 12, 2012 1:02 pm ] |
| Post subject: | Re: Flying Slope auto-trading EA |
Hi, does anybody trade this bot succesfully? if yes, please post your set-file. With ootb I have only loosing trades! Thanks |
|
| Author: | cuzgeorge [ Sun Sep 16, 2012 12:48 pm ] |
| Post subject: | Re: Flying Slope auto-trading EA |
Hi Mike, The pic results are the only one's i've ever had on FS. Please check the dates, about a month ago. I have since tried to play around with the settings and slope to try and get a trade out of it, but no luck. I also noticed TIG and TOIG are interested here, so stopped tinkering to see what they'll come up with. heres' what i got attached. set file and pic. regards, the other George. |
|
| Author: | Mike [ Fri Sep 21, 2012 7:36 pm ] |
| Post subject: | Re: Flying Slope auto-trading EA |
Thanks, I got some more trades, but quite often the program is not responding and I have to restart it. I loaded history many times, and I do not know, what stops it. Looking at the concept, it should be possible to get it working, but ... so I keep glancing at it and wonder why nobody works on it ... but right now, so many fascinating bots are worked on ... Thanks Mike |
|
| All times are UTC | Page 26 of 28 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|