I wrote a simple program that draws arrows whenever the Stochastic crosses above 20 or below 80. But sometimes the Stoch. completes the cycles before crossing 20 or 80. Unfortunately I'm not smart enough to write smth more complicated and need help with this if possible please. I do not know if this is too much to ask. Please let me know if this is the issue.
The idea is simple - to get a single arrow per cycle. Currently the program draws the arrows whenever the Stoch crosses 20 then 30, 40 etc... But what I want is to check for all crosses, e.g. CrossAbv 20, 30, 40... and if either one is true then draw the arrow and disregard the rest of the crosses. Below is the simple test code I wrote, which works lk OR, e.g. drawing arrows if cross abv 20 or 30, or 40... It would work if the Stoch. completes the cycle before crossing below 20% line then reverses somewhere around 25% and keep rising. But again, it would draw the arrows at 30, 40... But I want only one arrow per cycle, e.g. if it reverses at 25 then check for crosses above 25 and if cross abv 30 = true draw arrow and disregard the rest of the checks.
I do not know how to write a code that would draw arrow for the first cross and would disregard the rest.
Another thing that comes to mind but I do not have enough skills to implement this is how to check the MACD cross if Stoch. cross returns false, which sounds simple....
Thank you very much.
Thank you very much for you reply.
I think this will still work as OR. If the Stoch is below 20 and rising then if the Stoch > 20 && < 30 then cross abv 20 = true-draw arrow up. If Stoch. keeps rising and > 30 && < 40 then cross abv 30=true... Which will draw arrows first @20 then @30...@40... I maybe wrong but I don't think the else if will be skipped as you suggested. Or in case the Stoch is above 30 and rising the arrows will be drawn @ 30 and @40... But how to stop drawing arrows at the first cross, whichever cross this would be-20-30 or 40...? Then the next cross should be checked only when the prev. cycle is complete. This is the problem I cannot figure out.
Here is the example: the first cross was @20-draw arrow up at 20. Then the Stoch keeps rising abv 50 or higher. In this case only one arrow @20 should be drawn and crosses abv 30-40 should be disregarded.
Another example: In my code i have all three checks-if cross abv 20-30 or 40 true then do smth. The stoch is below 20 and rising - cross abv 20=true-then draw arrow up. Then after cross abv 20 it continues rising above 50-55. Then it reverses and falling and reached 27. Then it reverses back up @27 (creating higher low - the first low was below 20) and keeps rising. In this case the previous cross abv 20 and the cross above 30 are true and both arrows should be drawn at 20 and 30. Bcs to me the Stoch. completed the cycle going above 50 then it reverses back down and started the new cycle up @ 27. The cross above 40 should be disregarded - no arrow @40.
Thank you very much.
Last edited by Al2010; December 4th, 2010 at 08:10 PM.