hi friends
here is a metatrader based chart.
pipspring.
Can we have a code for similar plot-please
--------------------------------------------------------------------------------------------------------
//here is what I tried
//This is AFL of Heikin-Ashi(Koma-Ashi)with Moving Average.
//It's smoothly Heikin-Ashi derivative indicator,
//AND prevent to collapse a graph for first bars.
//----
//TOBY
//http://tobysoft.net/
//Formula:
/*
Heikin-Ashi(Koma-Ashi) with Moving Average Type
*/
SetChartOptions(2, chartWrapTitle);
// Calculate Moving Average
MAPeriod = Param("MA Period", 15, 1, 100);
MAOpen = EMA(Open, MAPeriod);
MAHigh = EMA(High, MAPeriod);
MALow = EMA(Low, MAPeriod);
MAClose = EMA(Close, MAPeriod);
HaClose = (MAOpen + MAHigh + MALow + MAClose) / 4;
HaOpen = AMA(Ref(HaClose, -1), 0.5);
// for graph collapse
for(i = 0; i <= MAPeriod; i++) HaClose = Null;
/*
// same
// HaOpen = (Ref(HaOpen, -1) + Ref(HaClose, -1)) / 2;
HaOpen[ 0 ] = HaClose[ 0 ];
for(i = 1; i < BarCount; i++) {
HaOpen = (HaOpen[i - 1] + HaClose[i - 1]) / 2;
}
*/
HaHigh = Max(MAHigh, Max(HaClose, HaOpen));
HaLow = Min(MALow, Min(HaClose, HaOpen));
// outs comments
"BarIndex = " + BarIndex();
"Open = " + Open;
"High = " + High;
"Low = " + Low;
"Close = "+ Close;
"HaOpen = " + HaOpen;
"HaHigh = " + HaHigh;
"HaLow = " + HaLow;
"HaClose = "+ HaClose;
// Plot graphs
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} HaOpen %g, HaHigh %g,
HaLow %g, HaClose %g (%.1f%%) {{VALUES}}",
HaOpen, HaHigh, HaLow, HaClose, SelectedValue(ROC( HaClose, 1))));
PlotOHLC(HaOpen, HaHigh, HaLow, HaClose, _DEFAULT_NAME(), ParamColor("Color",colorBlack), styleCandle);
//==========================================
//normal heikin ashi
HaClose =EMA((O+H+L+C)/4,3);
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "Modified " + Name(), colorBlack,styleCandle | styleNoLabel );
here is a metatrader based chart.
pipspring.
Can we have a code for similar plot-please
--------------------------------------------------------------------------------------------------------
//here is what I tried
//This is AFL of Heikin-Ashi(Koma-Ashi)with Moving Average.
//It's smoothly Heikin-Ashi derivative indicator,
//AND prevent to collapse a graph for first bars.
//----
//TOBY
//http://tobysoft.net/
//Formula:
/*
Heikin-Ashi(Koma-Ashi) with Moving Average Type
*/
SetChartOptions(2, chartWrapTitle);
// Calculate Moving Average
MAPeriod = Param("MA Period", 15, 1, 100);
MAOpen = EMA(Open, MAPeriod);
MAHigh = EMA(High, MAPeriod);
MALow = EMA(Low, MAPeriod);
MAClose = EMA(Close, MAPeriod);
HaClose = (MAOpen + MAHigh + MALow + MAClose) / 4;
HaOpen = AMA(Ref(HaClose, -1), 0.5);
// for graph collapse
for(i = 0; i <= MAPeriod; i++) HaClose = Null;
/*
// same
// HaOpen = (Ref(HaOpen, -1) + Ref(HaClose, -1)) / 2;
HaOpen[ 0 ] = HaClose[ 0 ];
for(i = 1; i < BarCount; i++) {
HaOpen = (HaOpen[i - 1] + HaClose[i - 1]) / 2;
}
*/
HaHigh = Max(MAHigh, Max(HaClose, HaOpen));
HaLow = Min(MALow, Min(HaClose, HaOpen));
// outs comments
"BarIndex = " + BarIndex();
"Open = " + Open;
"High = " + High;
"Low = " + Low;
"Close = "+ Close;
"HaOpen = " + HaOpen;
"HaHigh = " + HaHigh;
"HaLow = " + HaLow;
"HaClose = "+ HaClose;
// Plot graphs
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} HaOpen %g, HaHigh %g,
HaLow %g, HaClose %g (%.1f%%) {{VALUES}}",
HaOpen, HaHigh, HaLow, HaClose, SelectedValue(ROC( HaClose, 1))));
PlotOHLC(HaOpen, HaHigh, HaLow, HaClose, _DEFAULT_NAME(), ParamColor("Color",colorBlack), styleCandle);
//==========================================
//normal heikin ashi
HaClose =EMA((O+H+L+C)/4,3);
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "Modified " + Name(), colorBlack,styleCandle | styleNoLabel );
Last edited: