Simple Coding Help - No Promise.

thanks lot, i found one ribbon trend indicator , is it repainting one or good ?

_SECTION_BEGIN("Ribbon");

no=Param( "Swing", 20, 1, 55 );
res=HHV(H,no);
sup=LLV(L,no);
avd=IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0));
avn=ValueWhen(avd!=0,avd,1);
tsl=IIf(avn==1,sup,res);

Plot( 2, "Ribbon",IIf(C>tsl,colorBlue,colorRed),styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
 

amitrandive

Well-Known Member
Amit ji Yes i agree, but what i have observed is when explored it gives buy/sell for 5/200 crossover only & i also want crossover signals for ema 5/34 within it.
Regards.
Am out , have not tested , but you can try this.

Code:
Plot(Close,"Price",colorBlack, styleCandle);
 Plot(EMA(Close,5),"5EMA",colorBlue,style=styleThick);
 Plot(EMA(Close,34),"34EMA",colorRed,style=styleThick);
 Plot(EMA(Close,200),"200EMA",colorYellow,style=styleThick);

 Buy1=Cross(EMA(Close,5),EMA(Close,200));
 Buy2=Cross(EMA(Close,5),EMA(Close,34));
 Sell1=Cross(EMA(Close,200),EMA(Close,5)); 
Sell2=Cross(EMA(Close,34),EMA(Close,5));

Buy=Buy1 OR Buy2;
Sell=Sell1 OR Sell2;;

 shape = Buy * shapeUpArrow + Sell * shapeDownArrow; PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );
 _SECTION_END(); _SECTION_BEGIN("Magnified Market Price");
FS=Param("Font Size",30,11,100,1); 
GfxSelectFont("Times New Roman", FS, 700, True ); 
GfxSetBkMode( colorWhite ); GfxSetTextColor( ParamColor("Color",colorBlack) );
 Hor=Param("Horizontal Position",600,1,1200,1);
 Ver=Param("Vertical Position",1,1,830,1); GfxTextOut(""+C, Hor , Ver );
 YC=TimeFrameGetPrice("C",inDaily,-1); DD=Prec(C-YC,2); xx=Prec((DD/YC)*100,2); 
GfxSelectFont("Times New Roman", 11, 700, True ); GfxSetBkMode( colorWhite );
 GfxSetTextColor(ParamColor("Color",colorBlack) ); 
GfxTextOut(""+DD+" ("+xx+"%)", Hor , Ver+45 );
Filter=Buy OR Sell; 
 
AddColumn(IIf(Buy1,BuyPrice,Null)," Buy 5200 Signal ", 6.2,1.2,colorGreen); 
AddColumn(IIf(Buy2,BuyPrice,Null)," Buy 534 Signal ", 6.2,1.2,colorGreen); 
AddColumn(IIf(Sell1,SellPrice,Null)," Sell 5200 Signal ",6.2,1.2,colorOrange);
AddColumn(IIf(Sell2,SellPrice,Null)," Sell 534 Signal ",6.2,1.2,colorOrange); 
AddColumn(C,"LTP",6.2,1.2);
 _SECTION_END();
 
Hello friends & Seniors ..

Need help to draw exploration for Heikein ashi candle..

Its simple and successful method..


Help needed on these points -

1. If we get Flat base (Open = Low on Green candle ) = Buy

2. If we get Flat base (Open = High on red candle)

3. Need exploration of Doji candles.

or

other way -

1. List of all Green flat candles

2. List of all Red flat candles

3 List of all Doji candles.


Pls check the chart ..

http://imgur.com/cNfreub



Thanx you in advance..
 

amitrandive

Well-Known Member
Hello friends & Seniors ..

Need help to draw exploration for Heikein ashi candle..

Its simple and successful method..


Help needed on these points -

1. If we get Flat base (Open = Low on Green candle ) = Buy

2. If we get Flat base (Open = High on red candle)

3. Need exploration of Doji candles.

or

other way -

1. List of all Green flat candles

2. List of all Red flat candles

3 List of all Doji candles.


Pls check the chart ..

http://imgur.com/cNfreub



Thanx you in advance..

My amateur attempt.Seniors can improve :D


Code:
HaClose = (O + H + L + C)/4; 
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); 
HaHigh = Max( H, Max( HaClose, HaOpen ) ); 
HaLow = Min( L, Min( HaClose, HaOpen ) ); 
xDiff = (HaHigh - Halow) * 10000;
barcolor = IIf(HaClose >= HaOpen,colorGreen,colorRed);
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleCandle );

Buy1 =  Haopen==Halow ;
Buy2=barcolor==colorgreen;
Buy=Buy1 AND Buy2;
Sell1 =  Haopen==Hahigh ;
Sell2=barcolor==colorred;
Sell=Sell1 AND Sell2;
Doji = abs(Haopen-HaClose) / (HaHigh-HaLow)  < Param("O2C % of Range", 0.3,0.05,0.5,0.05);
Filter=Buy OR Sell Or Doji;
AddColumn(IIf(Buy,Buyprice,Null)," open=low ", 6.2,1.2,colorGreen);
AddColumn(IIf(Sell,Sellprice,Null)," open= high ",6.2,1.2,colorOrange); 
AddColumn(IIf(Doji,Close,Null)," open= close ",6.2,1.2,colorblue);
 
Last edited:

My amateur attempt.Seniors can improve :D


Code:
HaClose = (O + H + L + C)/4; 
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 ); 
HaHigh = Max( H, Max( HaClose, HaOpen ) ); 
HaLow = Min( L, Min( HaClose, HaOpen ) ); 
xDiff = (HaHigh - Halow) * 10000;
barcolor = IIf(HaClose >= HaOpen,colorGreen,colorRed);
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "", barcolor, styleCandle );

Buy1 =  Haopen==Halow ;
Buy2=barcolor==colorgreen;
Buy=Buy1 AND Buy2;
Sell1 =  Haopen==Hahigh ;
Sell2=barcolor==colorred;
Sell=Sell1 AND Sell2;
Doji = abs(Haopen-HaClose) / (HaHigh-HaLow)  < Param("O2C % of Range", 0.3,0.05,0.5,0.05);
Filter=Buy OR Sell Or Doji;
AddColumn(IIf(Buy,Buyprice,Null)," open=low ", 6.2,1.2,colorGreen);
AddColumn(IIf(Sell,Sellprice,Null)," open= high ",6.2,1.2,colorOrange); 
AddColumn(IIf(Doji,Close,Null)," open= close ",6.2,1.2,colorblue);


Amit ji..

thanx for your superb effort...

i made mistake to describe my logic.


I wish to search 1st Flat Green or Red candle on start of the trend as pointed in chart
in round or rectangle pattern. http://imgur.com/cNfreub

But in exploration made by you.. every new flat candle its exploring (I didnt mention the point)

Kindly help

Thanx you
 
Last edited:
I need add arrow when MA15 cross MA100 , anybody help me please , thanks



Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
_SECTION_END();

_SECTION_BEGIN("Mid MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 45, 2, 300, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
_SECTION_END();

_SECTION_BEGIN("Long MA");
P = ParamField("Price field",-1);
Periods = Param("Periods", 100, 2, 400, 1 );
Plot( MA( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale );
_SECTION_END();

_SECTION_BEGIN("BBands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorLightGrey );
Color = ColorBlend( Color, GetChartBkColor(), 0.5 );
Style = ParamStyle("Style", styleLine | styleNoLabel ) | styleNoRescale;;
Plot( bbt = BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), Color, Style );
Plot( bbb = BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), Color, Style );
PlotOHLC( bbt, bbt, bbb, bbb, "", ColorBlend( Color, GetChartBkColor(), 0.7 ), styleNoLabel | styleCloud | styleNoRescale, Null, Null, Null, -1 );
_SECTION_END();

_SECTION_BEGIN("Volume");
Color = ParamColor("Color", ColorRGB( 128, 128, 192 ) );
Plot( Volume, _DEFAULT_NAME(), ColorBlend( Color, GetChartBkColor(), 0.5 ), styleNoTitle | ParamStyle( "Style", styleHistogram | styleOwnScale | styleThick | styleNoLabel, maskHistogram ), 2 );
_SECTION_END();

_SECTION_BEGIN("Price Interpretation");
movshort = ParamField("Short Time MA", 8 );
movmed = ParamField("Mid Time MA", 9 );
movlong = ParamField("Long Time MA", 10 );
btop = ParamField("BBTop", 11 );
bbot = ParamField("BBBottom", 12 );
if( Status("action") == actionCommentary )
{
width = btop - bbot;
lslop = LinRegSlope( C, 30 ) + 100;
lslo = LLV( lslop, 90 );
lshi = HHV( lslop, 90 );
lswidth = lshi - lslo;
trend = 100*( lslop - lslo )/lswidth;

mawidth = MA( width, 100 );
relwidth = 100*(width - mawidth)/mawidth;

_N( tname = Name()+"("+FullName()+")" );

printf("Price and moving averages:\n");
printf( tname + " has closed " + WriteIf( C > movshort, "above" , "below" ) + " its Short time moving average. ");

printf("\nShort time moving average is currently " + WriteIf( movshort > movmed, "above", "below") + " mid-time, AND " + WriteIf( movshort > movlong, "above", "below" ) + " long time moving averages.");

printf("\nThe relationship between price and moving averages is: "+
WriteIf( C > movshort AND movshort > movmed, "bullish",
WriteIf( C < movshort AND movshort < movmed, "bearish", "neutral" ) ) + " in short-term, and "+
WriteIf( movshort > movmed AND movmed > movlong , "bullish",
WriteIf( movshort < movmed AND movmed < movlong, "bearish", "neutral" ) ) + " in mid-long term. ");

printf("\n\nBollinger Bands:\n");
printf(tname+ " has closed " +
WriteIf( C < bbot, "below the lower band by " +
WriteVal( 100 *( bbot-C )/ width, 1.1 ) + "%%. " +
WriteIf( trend < 30, " This combined with the steep downtrend can suggest that the downward trend in prices has a good chance of continuing. However, a short-term pull-back inside the bands is likely.",
WriteIf( trend > 30 AND trend < 70, "Although prices have broken the lower band and a downside breakout is possible, the most likely scenario for "+tname+" is to continue within current trading range.", "" ) ), "" ) +

WriteIf( C > btop, "above the upper band by " +
WriteVal( 100 *( C- btop )/ width, 1.1 ) + "%%. " +
WriteIf( trend > 70, " This combined with the steep uptrend suggests that the upward trend in prices has a good chance of continuing. However, a short-term pull-back inside the bands is likely.",
WriteIf( trend > 30 AND trend < 70, "Although prices have broken the upper band and a upside breakout is possible, the most likely scenario for "+tname+" is to continue within current trading range.", "" ) ), "" ) +

WriteIf( C < btop AND ( ( btop - C ) / width ) < 0.5,
"below upper band by " +
WriteVal( 100 *( btop - C )/ width, 1.1 ) + "%%. ",
WriteIf( C < btop AND C > bbot , "above bottom band by " +
WriteVal( 100 *( C - bbot )/ width, 1.1 ) + "%%. ", "" ) ));

printf("\n"+
WriteIf( ( trend > 30 AND trend < 70 AND ( C > btop OR C < bbot ) ) AND abs(relwidth) > 40,
"This picture becomes somewhat unclear due to the fact that Bollinger Bands are currently",
"Bollinger Bands are " )+
WriteVal( abs( relwidth ), 1.1 ) + "%% " +
WriteIf( relwidth > 0, "wider" , "narrower" ) +
" than normal.");

printf("\n");

printf(
WriteIf( abs( relwidth ) < 40, "The current width of the bands (alone) does not suggest anything conclusive about the future volatility or movement of prices.","")+
WriteIf( relwidth < -40, "The narrow width of the bands suggests low volatility as compared to " + tname + "'s normal range. Therefore, the probability of volatility increasing with a sharp price move has increased for the near-term. "+
"The bands have been in this narrow range for " + WriteVal(BarsSince(Cross(-40,relwidth)),1.0) + " bars. The probability of a significant price move increases the longer the bands remain in this narrow range." ,"")+
WriteIf( relwidth > 40, "The large width of the bands suggest high volatility as compared to " + tname + "'s normal range. Therefore, the probability of volatility decreasing and prices entering (or remaining in) a trading range has increased for the near-term. "+
"The bands have been in this wide range for " + WriteVal(BarsSince(Cross(relwidth,40)),1.0) + " bars.The probability of prices consolidating into a less volatile trading range increases the longer the bands remain in this wide range." ,""));

printf("\n\nThis commentary is not a recommendation to buy or sell. Use at your own risk.");
}
_SECTION_END();
 

Similar threads