I AM LOOKING FOR AN INDICATOR WHO PLOT A VERTICAL LINE ON THE CHART WHEN THE EMA34 AND EMA 8 CROSSOVER.
I CHECKED THE FORUM BUT I HAVE NOT FOUND THIS INDICATOR.
COULD YOU PLEASE ADDRESS ME WHERE TO FIND IT, OR EVENTUALLY HELP ME TO CONVERT THE EASYLANGUAGE CODE TO A NINJA SCRIPT?
HERE ATTACHED THE CODE AND ONE PHOTO ABOUT HOW THE INDICATOR SHOULD WORK.
HERE TO FOLLOW THE EASYLANGUAGE CODE:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
inputs:
double Price( Close ), { price used in average calculations for the
oscillator }
int FastLength( 8 ), { fast moving average length for oscillator }
int SlowLength( 34 ), { slow moving average length for oscillator }
Line1(True),
String LineColor1("Cyan"),
Line2(True),
String LineColor2("yellow");
Using elsystem.drawingobjects;
Using elsystem.drawing;
variables:
intrabarpersist bool InAChart( false ),
FastAvg( 0 ),
SlowAvg( 0 ) ,
double AO( 0 ),
bool AOSaucerBuy( false ),
bool AOCrossBuy( false ),
bool TwinPeaksBuy( false ),
bool LookForTwinPeaksBuy( false ),
bool AOSaucerSell( false ),
bool AOCrossSell( false ),
bool TwinPeaksSell( false ),
bool LookForTwinPeaksSell( false ),
bool AOPivotLow( false ),
double AOPivotLowVal( 0 ),
double AOPivotHighVal( 0 ),
bool AOPivotHigh( false ),
bool AlertCondition( false ),
string GridString( "" ) ,
VerticalLine VL(null);
Method void DrawVerticalLine() begin
VL = VerticalLine.Create(DTPoint.Create(BarDateTime,0)) ;
VL.Persist = False;
DrawingObjects.Add(VL);
End;
{ calculate the oscillator value }
AO = PriceOscillator( Price, FastLength, SlowLength ) ;
FastAvg = XAverage( Price, FastLength ) ;
SlowAvg = XAverage( Price, SlowLength ) ;
#region Formatting and Alerts
{
{ set histogram color }
if FastAvg > SlowAvg then
SetPlotColor( 1, HistUpColor )
else if FastAvg < SlowAvg then
SetPlotColor( 1, HistDownColor )
else
SetPlotColor( 1, GetPlotColor( 1 )[1] ) ;}
#region Buy Setups
AOCrossBuy = FastAvg crosses above SlowAvg ;
#endregion
#region Sell Setups
AOCrossSell = FastAvg crosses below SlowAvg ;
#endregion
{ plot dots on histogram in Charting for Buy and Sell setups, set RadarScreen text,
and trigger alerts }
if AOCrossBuy then
begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor1);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
end
else if AOCrossSell then
begin
DrawVerticalLine();
VL.Color = Color.FromName(LineColor2);
VL.Style = StyleType.Dashed;
VL.Weight = 0;
end
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
THANK YOU IN ADVANCE
MARCO
Comment