Hi,
I'm looking for some guidance around the formula Valuewhen. Basically when the indicator (in blue) is pointing down, I would like to plot the first occurrence of another indicator, when it peaks in red.
Now I have used FIRST = ValueWhen( down,peakdown,1); So the condition is when the indicator is down, and the array is the peaks in the other indicator, with a comma 1, for the first occurrence. All this seems to do is give me all Peaks when the other indicator is pointing down.
These formulas are timeframe set in the daily timeframe, and viewing this in a two hour timeframe.
Thanks for any help in advance.
TimeFrameSet(inDaily);
SIGNALzig = Zig(Signal(12,26,9),1);
SIGNALzig1=IIf(SIGNALzig>0,SIGNALzig,Zig(abs(SIGNALzig),1)*-1);
Stoch = Zig(StochD(14,3,3),1);
TimeFrameRestore();
StochEXPAND = TimeFrameExpand(Stoch,inDaily,expandFirst);
StochEXPANDzig = Zig(StochEXPAND,1);
SIGNALzigEXPAND= TimeFrameExpand(SIGNALzig,inDaily,expandFirst);
koko= Zig(SIGNALzigEXPAND,1);
koko1 = IIf(koko>0,koko,Zig(abs(koko),1)*-1);
SIGNALzigdaily = TimeFrameExpand(SIGNALzig1,inDaily,expandFirst);
down = koko1 < Ref(koko1,-1);
peakdown = StochEXPANDzig < Ref(StochEXPANDzig,-1)
AND Ref(StochEXPANDzig,-1)> Ref(StochEXPANDzig,-2);
FIRST = ValueWhen( down,peakdown,1);
Plot(SIGNALzigdaily,"blue", colorBlue,0,0,0,0,0,3 );
Plot( koko1,"", colorRed,0,0,0,1,3 );
Plot( StochEXPANDzig,"", colorRed,styleOwnScale,0,0,1,3 );
PlotShapes( IIf( FIRST, shapeCircle, shapeNone ), colorWhite, 0, 0, -40 );type or paste code here