| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Help In Establishing Sequence of Events https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=372 |
Page 1 of 1 |
| Author: | johnsund [ Thu Feb 23, 2012 1:23 pm ] |
| Post subject: | Help In Establishing Sequence of Events |
Am having trouble with coding so that in order for a trade to be valid certain conditions of independent indies must be met in sequence. Am able to get the indicators individually to work correctly, but need help in finding a way to establish something like the following: 1. Indie "A" has a set of parameters and specified conditions that have been met; 2. The EA then looks at indie "B". If the specified setting is not met, then no trade. If the specified setting is met then the trade is valid and it is taken, EXCEPT 3. If the specified setting is not met for indie "B" within "X" numberr of bars or in a settable period of time then the trade is not valid and the EA must then wait until a new sequence starts with indie "A" meeting the specified conditions again to restart the sequence. I hope my problem is clearly identified and that someone can help. Can provide specific indies and settings if that would help. Thanks for any assistance. |
|
| Author: | gaheitman [ Thu Feb 23, 2012 3:20 pm ] |
| Post subject: | Re: Help In Establishing Sequence of Events |
For two phase tests like this, I generally use two boolean variables LookingForBuy and LookingForSell. In the code that checks Indi A, have it set these as appropriate. Then when checking indi B, your code would be something like: Code: Select all Code: Select all George |
|
| Author: | SteveHopwood [ Fri Feb 24, 2012 1:28 am ] |
| Post subject: | Re: Help In Establishing Sequence of Events |
I have adopted this construct: TradeLong = true; TradeShort = true; if IndieA Long conditions fail, then TradeLong = false; if IndieB Long conditions fail, then TradeLong = false; if IndieA Short conditions fail, then TradeShort = false; if IndieB Short conditions fail, then TradeShort = false; if TradeLong = true, then send a long trade with whatever else is involved if TradeShort = true, then send a short trade with whatever else is involved From this, you can see that a trade will trigger unless any of the requirements fail. This is working well for me at the moment. Good to see you getting involved in actual coding John. Sing out when you need more help. |
|
| All times are UTC | Page 1 of 1 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|