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

[amibroker] How To Plot Long And Short Stop Alternately On One Chart?



PureBytes Links

Trading Reference Links


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/