Is this what you are trying to do?

PlusV=0;
PlusStay=0;
MinusV=0;
MinusStay=0;

PlusStay = C > Ref(C,-1) AND BarsSince(MinusV) > BarsSince(PlusV);
PlusV = C > Ref(C,-1) OR PlusStay;
MinusStay = C < Ref(C,-1) AND BarsSince(MinusV) < BarsSince(PlusV);
MinusV = C < Ref(C, -1) OR MinusStay;
printf("TEst = " + NumToStr(BarsSince (MinusV != Ref(MinusV,-1)), 1.3));

Plot(C, "Close", colorBlack, ParamStyle( "Price Style", styleBar, maskPrice ) );
Plot(plusStay, "PlusStay", colorBlue,  styleOwnScale);
Plot(MinusStay, "MinusStay", colorBrown,  styleOwnScale);
Plot(PlusV, "PlusV", colorBlue, styleDashed | styleOwnScale);
Plot(MinusV, "MinusV", colorBrown, styleDashed | styleOwnScale);

PlotShapes(plusV        * shapeUpArrow, colorGreen,     0, L, -5 );
PlotShapes(MinusV       * shapeDownArrow, colorRed,     0, H, -5 );


Barry

--- In [email protected], "attawootw2" <attawoo...@...> wrote:
>
> Please help , I'm unable to code the following : 
> 
> Plus variable to register 1 when the close has positive change and also 
> register 1 for the following unchanged close 
> 
> Minus variable to register 1 when the close has negative change and also 
> register 1 for the following unchanged close 
> 
> I have tried coding the following but did not work 
> 
> PlusV=0;
> PlusStay=0;
> 
> MinusV=0;
> MinusStay=0;
> 
> PlusStay = IIf ( (C-Ref(C,-1) == 0 )AND  BarsSince (MinusV != Ref(MinusV,-1)) 
> > BarsSince (PlusV != Ref(PlusV,-1)) , 1 , 0 ) ;
> 
> PlusV         = IIf ( C-Ref(C,-1) > 0 OR PlusStay, 1 , 0 )  ; 
> 
> 
> MinusStay = IIf ( (C-Ref(C,-1) == 0 )AND  BarsSince (MinusV != 
> Ref(MinusV,-1)) < BarsSince (PlusV != Ref(PlusV,-1)) , 1 , 0 ) ;
> 
> MinusV        = IIf ( C-Ref(C,-1) < 0 OR MinusStay, 1 , 0 )  ; 
> 
> 
> It only register 1 when there is change in close but does not register 1 for 
> the following unchanged C which I would like to register 1 following the most 
> recent Plus or Minus Signals whichever may be the case.
> 
> Thank you.
>


Reply via email to