Simple Coding Help - No Promise.

dear sirs
after a lot of brain squeezing i was able to get no syntax error....
but on plotting it is not giving desired result....:inpain:o_O:arghh:
please help me.....

_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", colorGreen ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "",3.2,3.2);
hts = Param ("Text Shift", -50,-100,100,10);
PlotText("RSI(14) >> " + WriteVal(RSI(14),fraction),
SelectedValue(BarIndex()+1)-(numbars/hts),SelectedValue(C),colorWhite);
//// Vchart
//This was converted from code created for TradeStation by Mark W. Helweg of ValueCharts.com
_SECTION_BEGIN("Price Bar Color");
VarR1 = Param( "Price Top", 8, 20, 1, 0 );
VarR2 = Param( "Price Middle Top", 4, 7.99, 1, 0 );
VarR3 = Param( "Price Middle", -3.99, 3.99, 1, 0 );
VarR4 = Param( "Price Middle Bottom", -4, -7.99, 1, 0 );
VarR5 = Param( "Price Bottom", -8, -20, 1, 0 );

PriceBarstyle = ParamStyle("Bar", styleBar, maskDefault);

Pricecolor = ParamColor( "VarR1", colorRed );
Pricecolor = ParamColor( "VarR2", colorYellow );
Pricecolor = ParamColor( "VarR3", colorGreen );
Pricecolor = ParamColor( "VarR4", colorYellow );
Pricecolor = ParamColor( "VarR5", colorRed );

TitleText = StrFormat("Price Bars " + "(%g,%g)", VarR1, VarR2);
PlotGrid( 0 );
_SECTION_END(); _SECTION_END ();

_SECTION_BEGIN("Price Bar Color");
dyncolorswitch = ParamToggle("Price Bar Color","On,Off");
dynamic_color = SetBarFillColor( IIf( "{{VALUES}}">"VarR1", colorRed, colorYellow));
dynamic_color = SetBarFillColor( IIf( "{{VALUES}}"=="VarR2", colorYellow, colorGreen));
dynamic_color = SetBarFillColor( IIf( "{{VALUES}}"=="VarR3", colorGreen, colorYellow));
dynamic_color = SetBarFillColor( IIf( "{{VALUES}}"=="VarR4", colorYellow, colorGreen));
dynamic_color = SetBarFillColor( IIf( "{{VALUES}}">"VarR5", colorRed, colorYellow));


Plot(c, "{{VALUES}}", dyncolorswitch, styleBar, Null, Null, 0, 0, 1);
_SECTION_END();




VarNumbars = Param("Number of bars",5,2,1000,1);
Color = Param("Bar Color",colorGreen);
Top = Param("Top bar Color",8); ParamColor("Bar color",colorRed);
TopMid = Param("Top Mid Bar Color",4); ParamColor("Bar color",colorYellow);
Bottom = Param("Bottom Bar Color",-8); ParamColor("Bar color",colorRed);
//Plot(Top,"Top Bar",colorRed); IIf( "{{VALUES}}">"VarR1", colorRed, colorYellow);
//Plot(TopMid,"Top Mid Bar",colorYellow); IIf(ValueWhen>=4, <=7.99, 0);
//Plot(BottomMid,"Bottom Mid bar",colorYellow); IIf(ValueWhen<=-4, >=-7.99, 0);
//Plot(Bottom,"Bottom Chart Line",colorRed); IIf(ValueWhen<=-8, 1, 0) ;

LRange = 0;
VarP = round(VarNumBars/5);
if (VarNumBars > 7)
{
VarA=HHV(H,VarP)-LLV(L,VarP);
VarR1 = IIf(VarA==0 AND VarP==1,abs(C-Ref(C,-Varp)),VarA);
VarB=Ref(HHV(H,VarP),-VarP+1)-Ref(LLV(L,VarP),-VarP);
VarR2 = IIf(VarB==0 AND VARP==1,abs( Ref(C,-VarP)-Ref(C,-Varp*2) ),VarB);
VarC=Ref(HHV(H,VarP),-VarP*2)-Ref(LLV(L,VarP),-VarP*2);
VarR3 = IIf(VarC == 0 AND VarP==1,abs(Ref(C,-Varp*2)-Ref(C,-Varp*3)),VarC);
VarD = Ref(HHV(H,VarP),-VarP*3)-Ref(LLV(L,VarP),-VarP*3);
VarR4 = IIf(VarD == 0 AND VarP==1,abs(Ref(C,-Varp*3)-Ref(C,-Varp*4)),VarD);
VarE = Ref(HHV(H,VarP),-VarP*4)-Ref(LLV(L,VarP),-VarP*4);
VarR5 = IIf(VarE == 0 AND VarP==1,abs(Ref(C,-Varp*4)-Ref(C,-Varp*5)),VarE);
LRange=((VarR1+VarR2+VarR3+VarR4+VarR5)/5)*.2;
};


CDelta = abs(C - Ref(C,-1));
if (VarNumBars <=7)
{
Var0 = IIf(CDelta > (H-L) OR H==L,CDelta,(H-L));
LRange = MA(Var0,5)*.2;
}
MidBarAverage = MA( (H+L)/2,VarNumbars);
VOpen = (Open- MidBarAverage)/LRange;
VHigh = (High-MidBarAverage)/LRange;
VLow = (Low-MidBarAverage)/LRange;
VClose = (Close-MidBarAverage)/LRange;
//PlotOHLC(VOpen,VHigh,VLow,VClose,"ValueChart",dyncolorswitch, styleBar| styleNoTitle ,-12,12);
Title= Name() + " " + WriteVal( DateTime(), formatDateTime )+
"\nVOpen " + VOpen + "\n"+ " VHigh "+ VHigh + "\n"+ " VLow " + Vlow + "\n"+ " VClose " + VClose;
Filter = Volume > 50000;
AddColumn( VOpen, "VOpen");
AddColumn( VHigh, "VHigh");
AddColumn( VLow, "VLow");
AddColumn( VClose, "VClose");
_SECTION_END();
 

hir0406

Active Member
Can we plot yesterday's close line on today's intraday chart in amibroker. close level should be daily close and not intraday close.

Sent from my MI 4W using Tapatalk
 
s dear u can plot using

_SECTION_BEGIN("Display Prev C");



// Get Previous Day's close,
Prev_Close = TimeFrameGetPrice( "C", inDaily, -1, expandFirst) ;

Today = LastValue(Day() );



Plot(IIf(Today == Day(), Prev_Close, Null), "Prev Close",ParamColor("Prev. Close", colorbluegrey), styleLine|styleThick|styleNoRescale);



_SECTION_END();
 
s dear u can plot using

_SECTION_BEGIN("Display Prev C");



// Get Previous Day's close,
Prev_Close = TimeFrameGetPrice( "C", inDaily, -1, expandFirst) ;

Today = LastValue(Day() );



Plot(IIf(Today == Day(), Prev_Close, Null), "Prev Close",ParamColor("Prev. Close", colorbluegrey), styleLine|styleThick|styleNoRescale);



_SECTION_END();
thanks a ton.
but just need little more help. can we get historical close lines also?
 
s dear u can plot using

_SECTION_BEGIN("Display Prev C");



// Get Previous Day's close,
Prev_Close = TimeFrameGetPrice( "C", inDaily, -1, expandFirst) ;

Today = LastValue(Day() );



Plot(IIf(Today == Day(), Prev_Close, Null), "Prev Close",ParamColor("Prev. Close", colorbluegrey), styleLine|styleThick|styleNoRescale);



_SECTION_END();

see I wanted alf to show previous daily close/ current day open / and current day pivot point
with options to change colour/with /style.... hope this is possible. thanks for all help
 
see I wanted alf to show previous daily close/ current day open / and current day pivot point
with options to change colour/with /style.... hope this is possible. thanks for all help
_SECTION_BEGIN("Fibo Pivots");

SetChartOptions(0,chartShowDates);
GraphXSpace=5;
Plot(C,"",colorBlack,styleCandle);


PH = DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1); // yesterdays high
PL = DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
PC = DayC = TimeFrameGetPrice("C", inDaily, -1); // yesterdays close
PR = PH - PL;
//DayO = TimeFrameGetPrice("O", inDaily); // current day open

numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;
R=PH-PL;//range
P=(PH+PL+PC)/3; pI = LastValue (p,1);// Standard Pivot
fr1 = p + (R * 0.38); fr1I = LastValue (fr1,1);
fr2 = p + (R * 0.62); fr2I = LastValue (fr2,1);
fr3 = p + (R * 0.99); fr3I = LastValue (fr3,1);
fs1 = p - (R * 0.38); fs1I = LastValue (fs1,1);
fs2 = p - (R * 0.62); fs2I = LastValue (fs2,1);
fs3 = p - (R * 0.99); fs3I = LastValue (fs3,1);

Plot(p,"Pivot",colorBlue,styleDots|styleNoLine|styleNoRescale);
Plot(fr1,"R1",colorPink,styleDots|styleNoLine|styleNoRescale);
Plot(fr2,"R2",colorPink,styleDots|styleNoLine|styleNoRescale);
Plot(fr3,"R3",colorPink,styleDots|styleNoLine|styleNoRescale);
Plot(fs1,"S1",colorPink,styleDots|styleNoLine|styleNoRescale);
Plot(fs2,"S2",colorPink,styleDots|styleNoLine|styleNoRescale);
Plot(fs3,"S3",colorPink,styleDots|styleNoLine|styleNoRescale);
PlotText(" Pivot ", LastValue(BarIndex())-(numbars/Hts), pI, colorBlue);
PlotText(" Fib R1 " , LastValue(BarIndex())-(numbars/Hts), fr1I, colorRed);
PlotText(" Fib R2 " , LastValue(BarIndex())-(numbars/Hts), fr2I, colorPink);
PlotText(" Fib R3 " , LastValue(BarIndex())-(numbars/Hts), fr3I, colorRose);
PlotText(" Fib S1 " , LastValue(BarIndex())-(numbars/Hts), fs1I, colorGreen);
PlotText(" Fib S2 " , LastValue(BarIndex())-(numbars/Hts), fs2I, colorLime);
PlotText(" Fib S3 " , LastValue(BarIndex())-(numbars/Hts), fs3I, colorPaleGreen);
_SECTION_END();

_SECTION_BEGIN("Display Prev HLC");

Show_Prev = ParamToggle("Display Prev HLC", "No|Yes", 1);

// Get Previous Day's close, Low and High
Prev_Close = TimeFrameGetPrice( "C", inDaily, -1, expandFirst) ;

Today = LastValue(Day() );

if(Show_Prev)
{
Plot(IIf(Today == Day(), Prev_Close, Null), "Prev Close",ParamColor("Prev. Close", colorBlueGrey), styleLine|styleThick|styleNoRescale);

}
day_open = TimeFrameGetPrice( "o", inDaily, 1, expandFirst) ;
{
lot(IIf(Today == Day(), day_open, Null), "day open",ParamColor("day open", colorWhite), styleLine|styleThick|styleNoRescale);
}

_SECTION_END();


can you please correct because it shows some syntax error in last line
 
{
lot(IIf(Today == Day(), day_open, Null), "day open",ParamColor("day open", colorWhite), styleLine|styleThick|styleNoRescale);
}

You can add "P" ln the last line like

{
Plot(IIf(Today == Day(), day_open, Null), "day open",ParamColor("day open", colorWhite), styleLine|styleThick|styleNoRescale);
}
 
{
lot(IIf(Today == Day(), day_open, Null), "day open",ParamColor("day open", colorWhite), styleLine|styleThick|styleNoRescale);
}

You can add "P" ln the last line like

{
Plot(IIf(Today == Day(), day_open, Null), "day open",ParamColor("day open", colorWhite), styleLine|styleThick|styleNoRescale);
}
download.png
 

john302928

Well-Known Member
I want to scan in Amibroker to filter that stocks if they had MA cross in 5 min time frame
From 12.3.2018 to 12.3.2018. I should be able to change the time frame. Does anyone know how to do it? if so please help me with the code. Thanks
 
DayH11= TimeFrameGetPrice("H", inDaily, -1); DayH1I = LastValue (DayH11,1);
DayL11= TimeFrameGetPrice("L", inDaily, -1); DayL1I = LastValue (DayL11,1);
DayC11= TimeFrameGetPrice("C", inDaily, -1); DayC1I = LastValue (DayC11,1);
DayO11= TimeFrameGetPrice("O", inDaily, -1); DayO1I = LastValue (DayO11,1);

the above is samplecode. You can add code n number of days and plot it as per your requirement
 

Similar threads