Simple Coding Help - No Promise.

MM

The code is not for Amibroker.It is the code for the trading view charts.
:D
---------------------------------------------------------------------------------------
 
Last edited:

Nehal_s143

Well-Known Member
hope this is what you are looking

Code:
_SECTION_BEGIN("Price");
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() ); 

emaSlow = EMA(Close, 62);
emaFast = EMA(Close, 38);
Plot(emaFast,"",colorBlack, styleLine|styleThick);
Plot(emaSlow,"",colorBlack, styleLine|styleThick);
PlotOHLC( 0, emaFast, emaSlow, emaSlow,   "", IIf(emaFast >= emaSlow ,colorBrightGreen,ColorRGB(150,0,50)), styleCloud|styleNoLabel);

mycema=IIf(emaFast > emaSlow ,colorBlue,
       IIf(emaFast < emaSlow,colorRed,31));

Plot(6, "", mycema, styleOwnScale| styleArea|styleNoLabel,-0.5,100);
_SECTION_END();
 

jallanankit

Well-Known Member
Buy and Sell is based on today's high and low.
So the arrows will keep on changing as today's high low keeps on changing till market closes for the day.
What u say is right..

What i want is..

Say for example:

At 9.20, Nifty had a high of 8100 and low of 8080

now if after 920, nifty breaks high.. then i want buy candle at that break of high.. look for fixed profits or SL

Again, if nifty breaks high at 1020, i want tht a new buy candle should appear..

and the prev buy which came at break of 920 high should stay and if that call is continuing and both target and SL are not hit, then new buy should not come..
 
Thank u for the correction.. Hope this is fine..

Thanks shirajroz

Pls look after the continuous changing buy/short arrows in the code attached..

Will delete that code from the post!!

Code:
_SECTION_BEGIN("Price");
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() ); 
_SECTION_END();

H1 = TimeFrameGetPrice("H", inDaily); // Today's high
L1 = TimeFrameGetPrice("L", inDaily); // Today's low
Plot(H1, "",colorBrightGreen,styleDashed);
Plot(L1, "",colorDarkRed,styleDashed);

Buy = High >= Ref(H1,-1);
Short = Low <= Ref(L1 ,-1) ;

Sell =  Short;
Cover =  Buy;

Buy=ExRem(Buy,Short);
Short=ExRem(Short,Buy);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-25);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-35); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=25);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=35); 
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30);
PlotShapes(IIf(Sell, shapeStar, shapeNone),colorRed, 0, L, Offset=-15);
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorGold, 0,L, Offset=-15);
What u say is right..

What i want is..

Say for example:

At 9.20, Nifty had a high of 8100 and low of 8080

now if after 920, nifty breaks high.. then i want buy candle at that break of high.. look for fixed profits or SL

Again, if nifty breaks high at 1020, i want tht a new buy candle should appear..

and the prev buy which came at break of 920 high should stay and if that call is continuing and both target and SL are not hit, then new buy should not come..
jallanankit Bro,
hope this Helps, with a lower TF like 1mnt ,3mnt or 5mnt.

Code:
_SECTION_BEGIN("Price");
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() ); 
_SECTION_END();

H1 = TimeFrameGetPrice("H", inDaily); // Today's high
L1 = TimeFrameGetPrice("L", inDaily); // Today's low
Plot(H1, "",colorBrightGreen,styleDashed);
Plot(L1, "",colorDarkRed,styleDashed);

Buy1 = High >= Ref(H1,-1);
Short1 = Low <= Ref(L1 ,-1) ;
Buy=Ref(Buy1,-1);
Short=Ref(Short1,-1);
Sell =  Short;
Cover =  Buy;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

BuyPrice=ValueWhen(Buy,O,1);
ShortPrice=ValueWhen(Short,O,1);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-25);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-35); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=25);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=35); 
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30);
PlotShapes(IIf(Sell, shapeStar, shapeNone),colorRed, 0, L, Offset=-15);
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorGold, 0,L, Offset=-15);
 
Last edited:

extremist

Well-Known Member
Thank u for the correction.. Hope this is fine..

Thanks shirajroz

Pls look after the continuous changing buy/short arrows in the code attached..

Will delete that code from the post!!

Code:
_SECTION_BEGIN("Price");
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() ); 
_SECTION_END();




H1 = TimeFrameGetPrice("H", inDaily); // Today's high
L1 = TimeFrameGetPrice("L", inDaily); // Today's low
Plot(H1, "",colorBrightGreen,styleDashed);
Plot(L1, "",colorDarkRed,styleDashed);

Buy = High >= Ref(H1,-1);
Short = Low <= Ref(L1 ,-1) ;

Sell =  Short;
Cover =  Buy;

Buy=ExRem(Buy,Short);
Short=ExRem(Short,Buy);



PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-25);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-35); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=25);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=35); 
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30);
PlotShapes(IIf(Sell, shapeStar, shapeNone),colorRed, 0, L, Offset=-15);
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorGold, 0,L, Offset=-15);
@ Ankit

I hope this is wht u have wanted.
plz chk.
Code:
_SECTION_BEGIN("Price");
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() ); 
_SECTION_END();
newday=Day() != Ref(Day(),-1);
h1 = HighestSince(newday,H);
l1 = LowestSince(newday,l);

Plot(H1, "\nHi",colorBrightGreen,styleDashed);
Plot(L1, "\nLo",colorDarkRed,styleDashed);

Buy1 = High >= Ref(H1,-1);
Short1 = Low <= Ref(L1 ,-1) ;
Buy=Ref(Buy1,-1);
Short=Ref(Short1,-1);
Sell =  Short;
Cover =  Buy;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

BuyPrice=ValueWhen(Buy,O,1);
ShortPrice=ValueWhen(Short,O,1);

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-25);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-35); 
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=25);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=35); 
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30);
PlotShapes(IIf(Sell, shapeStar, shapeNone),colorRed, 0, L, Offset=-15);
PlotShapes(IIf(Cover, shapeStar, shapeNone),colorGold, 0,L, Offset=-15);
 

amitrandive

Well-Known Member
In my over 20 years trading career, every quarter I come across a person who claims that he has a magic system or a Guru who claims that he has all the solutions for trading. All are 100 % bogus. The new traders particularly failed and struggling traders always have a false notion that out there somewhere there is some secret method,system which never fails which successful traders have.Nothing can be far from the truth.

No AFL,System or a trading Guru has any shortcut for trading success and trading riches.At best they can guide but the trader has to develop himself into a successful trader and that is no easy task.

Smart_trade
:thumb::clap::clap::clap:
 

zuma

Active Member
I need help regarding an EXPLORER

i need explorer in 3 column for

1-20 days average price range
2-20 days average price range in percentage (%)
3-20 days Average volume

thank you.
 

amsin21

Well-Known Member
Help required for AFL code to change the candle color for the below condition.

Close > EMA 55 = Bright Green
Close < EMA 55 = Pink

Only that particular candle need color change, the rest should follow the standard green/red color.

Thanks,
 

Similar threads