I'm still hard at work on this new strategy. I've made a few changes and I've run into something I'm not quite sure how to handle.
In my strategy, there is a scenario where the bar closes above the upper band of a moving average envelope, and at that point, I would like for the strategy to play a sound. At the CLOSE of that bar. Not in the middle... or when it touches the band... but at the instant the bar closes ABOVE the band.
Okay... that's the first scenario... here's the second:
There is also a time when price opens above the upper band of the moving average envelope. In that case, I would like for the strategy to draw a dot. When the open is ABOVE the envelope's upper band.
Now... to make things more interesting... I want the scenario to be "calculate on bar close == false" because I want the dot to be drawn the INSTANT the bar opens above the upper band... and NOT after that bar has closed...
There are two things happening which are making me a bit crazy...
First... instead of the strategy playing the sound at the CLOSE of the bar... it is playing the sound over and over again as the bar bumps up against the upper band on its way to closing above it. In other words, instead of it playing the sound once at the close of the bar... it is playing it over and over again once the bar touches the upper band.
Even though I have the strategy set to calculate intra-bar... doesn't it know the difference between a bar in progress and a bar that has closed?
If (Close[0] > MAEnvelopes(blah, blah,).Upper[0]
{
PlaySound(blah, blah);
}
Now on to the second problem I'm having...
I have the strategy set to draw a dot when the bar opens above the upper band.
if (Open[0] > MAEnvelopes(blah, blah).Upper[0])
{
DrawDot(blah, blah);
}
As always, I truly enjoy and benefit greatly from your responses, and I thank you in advance for your help on this.
-V

not arbitrarily readjusting anything. If you want your code to behave differently, you will have to code it to do so.




Comment