PureBytes Links
Trading Reference Links
|
hi,
After looking at how SAR is plotted:
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color",
colorCycle ), ParamStyle("Style", styleDots | styleNoLine, maskDefault
| styleDots | styleNoLine ) );
I find the algorism is not implemented using the Plot function, it is
in the SAR function. So my suggestion is:
A function, let's call it MyStop:
//pls refer to AFL syntax, I am a newbe
function (return type) MyStop(...){
...
if(LongSignal){
stpValue=[calculate long stop value];
}
else{
stpValue=[calculate short stop value];
}
return stpValue;
}
Then plotting is simple and easy:
Plot( MyStop(...), ...);
//Note here: Just as SAR, plot it as dots, not line. If line, looks
too strange.
zwz
--- In amibroker@xxxxxxxxxxxxxxx, "Lesmond V" <ebsn247@xxxx> wrote:
>
> Here is the simple ATR-based system.
>
> I can't figure out how to plot the line for the "TrailingStopLong"
> only when the candles are green ("LongSignal") and the line for the
> "TrailingStopShort" only when the candles are red ("ShortSignal").
>
> With the code below the lines for both stops are plotted together all
> the time.
>
> Help appreciated
>
> Lesmond
> -------
>
> LongSignal = C > ( LLV( L, 20 ) + 2 * ATR( 10 ) );
> ShortSignal = C < ( HHV( H, 20 ) - 2 * ATR( 10 ) ); //this variable
> is not in use in this test
> DynamicColour = IIf( LongSignal, colorLime, colorRed);
>
> TrailingStopLong = HHV( C - 2 * ATR(10), 15 );
> TrailingStopShort = LLV( C + 2 * ATR(10), 15 );
>
> IIf( LongSignal, Plot( TrailingStopLong, "", 38, 512 ), Plot(
> TrailingStopShort, "", 53, 512 ));
>
> Title = Name()+" \\c11"+Interval(format=2)+" "+Date()+"\\c-1 C="+C;
> Plot( Close, "", DynamicColour, 64 );
> SetChartOptions(0, chartShowDates);
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|