[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Coding difficulty - Please help



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "attawootw2" <attawootw2@xxx> 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.
>




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/