| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Who wants a challenge? https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=794 |
Page 1 of 2 |
| Author: | fxprotrader [ Sun Sep 02, 2012 6:08 pm ] |
| Post subject: | Who wants a challenge? |
I'm trying to code the following. This would be a Buy trade. I have tried a for loop, a mess of if conditions and neither has produced results I'm looking for. It appears to be simple but I have not been able to get it working. |
|
| Author: | gaheitman [ Sun Sep 02, 2012 6:38 pm ] |
| Post subject: | Re: Who wants a challenge? |
Are you trying to put this in an EA? |
|
| Author: | fxprotrader [ Sun Sep 02, 2012 6:49 pm ] |
| Post subject: | Re: Who wants a challenge? |
Sorry forgot to mention that but, yes. |
|
| Author: | gaheitman [ Sun Sep 02, 2012 7:11 pm ] |
| Post subject: | Re: Who wants a challenge? |
Are you entering after a bar closes? You can't know while a bar is open whether the low will stay above the MA or that the high will stay below MA+5. How do you start trading, once a bar straddles the MA? How are you picking the direction? |
|
| Author: | fxprotrader [ Sun Sep 02, 2012 7:19 pm ] |
| Post subject: | Re: Who wants a challenge? |
Yes, last closed as soon as the bar straddles the MA. The direction was picked on a higher timeframe. I'm using the buy as an example but as a rule if price moves from below the MA up through would always be a buy. Also want to mention that if the high does not reach MA +5 within 5 bars, the 5th bar would be the last you could enter on. The only code I need is after the last bar straddles the MA(last Blue arrow) |
|
| Author: | gaheitman [ Sun Sep 02, 2012 7:58 pm ] |
| Post subject: | Re: Who wants a challenge? |
The code wouldn't be much different from what you are doing to enter your straddle trades, you are just looking for the Low[1] > MA && High[1] < MA+5 Pips. You'll have to keep track of the number of trades you enter and stop at 5 or when you hit one of the High/Low conditions. If you post the code that is entering the first trades it would be easier to help.... George |
|
| Author: | fxprotrader [ Sun Sep 02, 2012 10:45 pm ] |
| Post subject: | Re: Who wants a challenge? |
A clarification;there is a 5 pip, 5 bar window after the straddle bar and only 1 trade would be entered. I have attached my test file. What I have at this point is the straddle bar and the 1st after it. I'm marking with arrows whether its an eligible bar. |
|
| Author: | Bruce Flea [ Mon Sep 03, 2012 7:46 am ] |
| Post subject: | Re: Who wants a challenge? |
Still not clear on how you propose to determine direction that gaheitman asked for clarification on as well. Something like: Code: Select all And you have nothing that would currently indicate your program is looking to open a trade. In fact, it's still coded as an indicator. |
|
| Author: | fxprotrader [ Mon Sep 03, 2012 9:19 am ] |
| Post subject: | Re: Who wants a challenge? |
Determining direction is the easy part. I've got that all worked out. If you take what I have in the screenshot using the M1 timeframe and start at August 02, 10:15 this will be a buy. I have updated the code where it works fairly well up to about the 4th bar past the straddle, but this is way too inefficient, there's got to be a better way to do this. I've tried using a loop structure and again came very close to what I needed but in the end just was not correct. As I said it looks simple, but unless I'm missing something obvious it's not. As far as it being coded as an indicator it is not, as I stated in the last post all I'm trying to determine at this point is which bars are eligible to execute a trade on, once I have that worked out then I'll put my code in to execute the trade. I'm marking the eligible bars with an arrow. Code: Select all |
|
| Author: | Bruce Flea [ Mon Sep 03, 2012 10:44 am ] |
| Post subject: | Re: Who wants a challenge? |
I missed your reference to a higher time frame for direction. Sorry 'bout that! As for your conundrum, then as long as it was under that +5 pip limit, wouldn't the first bar that crosses just be your default? Especially since it fits your rules posted in the pic above. And you're right. Telling it to wait, after it does get a valid signal will be difficult. I'll be interested to see what comes of this. Cheers! |
|
| All times are UTC | Page 1 of 2 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|