Simple Coding Help - No Promise.

amitrandive

Well-Known Member
HEY FRIENDS ...

This afl is plotting only in current days HLC... it is much better if it is possible to get in each day which will help to back-test or practicing in bar replay ...

Regards ...

below code will plot only line

_SECTION_BEGIN("PreDay HLC");
//TIME FRAME CALCULATION
H1 = TimeFrameGetPrice("H", inDaily, -1); // yesterdays high
L1 = TimeFrameGetPrice("L", inDaily, -1); // low
C1= TimeFrameGetPrice("C", inDaily, -1); // close
DayO = TimeFrameGetPrice("-1", inDaily); // current day open

//PLOTS

Plot(H1, "",colorRed,styleLine+styleThick+styleNoRescal e+st yleNoLabel);
Plot(L1, "",colorBrightGreen,styleLine+styleThick+style NoLa bel);
Plot(C1, "",colorLightGrey,styleLine+styleNoRescale+sty leNo Label);
_SECTION_END();

Thanks
cellclinic

If I interpret your requirement correctly, you want to display today's high and low instead of yesterday's.
I have modified the code to do that,but have left the plot of yesterday close

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

_SECTION_BEGIN("PreDay HLC");
//TIME FRAME CALCULATION
H1 = TimeFrameGetPrice("H", inDaily, 0); //today's high
L1 = TimeFrameGetPrice("L", inDaily, 0); //today's low
C1= TimeFrameGetPrice("C", inDaily, 0); // close
DayO = TimeFrameGetPrice("-1", inDaily); // current day open

//PLOTS

Plot(H1, "",colorRed,styleLine+styleThick+styleNoRescale+styleNoLabel);
Plot(L1, "",colorBrightGreen,styleLine+styleThick+styleNoLabel);
Plot(C1, "",colorYellow,styleLine+styleThick+styleNoRescale+styleNoLabel);
_SECTION_END();
 

Nehal_s143

Well-Known Member
dear all

pls help me in making an afl where bollinger bands are used:
  • BUY is break of high of a candle which touches the BBtop
  • SELL is touch of BBbot
  • SHORT is break of low of a candle which touches the BBbot
  • COVER is touch of BBtop

thks
try this

Code:
_SECTION_BEGIN("Bollinger_Bands_width");
pds=Param("Periods",20,2,200);
sd=Param("Band Width",2, 0.01,10);
alpha=2/(pds+1);
mt=AMA( C, alpha );
ut=AMA( mt, alpha );
dt=((2-alpha)*mt-ut)/(1-alpha);
mt2=AMA(abs(C-dt), alpha );
ut2=AMA(mt2,alpha );
dt2=((2-alpha)*mt2-ut2)/(1-alpha);
but=dt+sd*dt2;
blt=dt-sd*dt2;

Plot( but, "Upper band", colorLightGrey, styleLine | styleDots, maskAll );
Plot( blt, "Lower band", colorLightGrey, styleLine | styleDots, maskAll);
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

//Note:- If you change parameter of BBands then change manually also in Explorer, otherwise you will NOT get desire result.


_SECTION_BEGIN("Explorer");

bb= C > BBandTop( C, 20, 2) AND Ref (C,-1) < Ref(BBandTop( C, 20, 2),-1);
bb1= C < BBandBot( C, 20, 2) AND Ref (C,-1) > Ref(BBandBot( C, 20, 2),-1);
bb_status= WriteIf(BB, "AboveTop", WriteIf(bb1, "BelowBottom", "Neutral"));
bb_Col=IIf(bb, colorGreen, IIf(bb1, colorRed, colorLightGrey));


/* RESULTS */
Filter = MA(Volume,20) > 10000;
AddColumn( Close, "Close " );
AddColumn( Volume, "Volume " );
AddTextColumn(bb_status, "BBand", 1, colorWhite, bb_Col);

Buy = Cross(C , but);
Sell = Cross(blt , C);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
shape = Buy * shapeUpTriangle + Sell * shapeDownTriangle;
PlotShapes( shape, IIf( Buy, colorWhite, colorCustom12 ), IIf( Buy, Low, High ) );

_SECTION_END();

SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel color ",colorDarkGrey)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel color upper half", colorBlack),
ParamColor("Inner panel color lower half", colorDarkOliveGreen)); // color of inner panel
Title = EncodeColor(colorWhite)+ "BBW+SCAN+EXP By HULK" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V);
 

cellclinic

Well-Known Member
That is also ok ... but my req is that this afl plots YHLC only in current day chart ( If i run bar replay for learning purpose ... I am unable to find same YHLC lines in previous days charts ) ... I req it to be plotted same in previous days too ...

Also it is bit easy that it starts in new day only instead of retracing in next day ... it hide price @ open also plz keep line settings & colors same as previous ...

cellclinic

If I interpret your requirement correctly, you want to display today's high and low instead of yesterday's.
I have modified the code to do that,but have left the plot of yesterday close

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

_SECTION_BEGIN("PreDay HLC");
//TIME FRAME CALCULATION
H1 = TimeFrameGetPrice("H", inDaily, 0); //today's high
L1 = TimeFrameGetPrice("L", inDaily, 0); //today's low
C1= TimeFrameGetPrice("C", inDaily, 0); // close
DayO = TimeFrameGetPrice("-1", inDaily); // current day open

//PLOTS

Plot(H1, "",colorRed,styleLine+styleThick+styleNoRescale+styleNoLabel);
Plot(L1, "",colorBrightGreen,styleLine+styleThick+styleNoLabel);
Plot(C1, "",colorYellow,styleLine+styleThick+styleNoRescale+styleNoLabel);
_SECTION_END();
 

Nehal_s143

Well-Known Member
dear all

pls help me in making an afl where bollinger bands are used:
  • BUY is break of high of a candle which touches the BBtop
  • SELL is touch of BBbot
  • SHORT is break of low of a candle which touches the BBbot
  • COVER is touch of BBtop

thks
also try this one

Code:
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", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

Plot(C,"",1,128);

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), colorGold, Style ); 
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), colorGold, Style ); 
_SECTION_END();


top1=BBandTop(p,20,2);
bot1=BBandBot(p,20,2);




Buy=(Cross(C,bot1));
Sell=(Cross(top1,C));


PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,Low,Offset=-15);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,High,Offset=-15);
 

amitrandive

Well-Known Member
That is also ok ... but my req is that this afl plots YHLC only in current day chart ( If i run bar replay for learning purpose ... I am unable to find same YHLC lines in previous days charts ) ... I req it to be plotted same in previous days too ...

Also it is bit easy that it starts in new day only instead of retracing in next day ... it hide price @ open also plz keep line settings & colors same as previous ...
cellclinic

Would you care to explain with an image(I am trying to understand with my limited knowledge).

If you want to practice on yesterday's chart ,you can set bar replay date to be yesterday's date.
 

xsis

Active Member
thks nehal! though both the codes dont work according to my conditions, atleast you gave me the framework to try out few things!
also try this one

Code:
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", colorWhite ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

Plot(C,"",1,128);

_SECTION_BEGIN("Bollinger Bands");
P = ParamField("Price field",-1);
Periods = Param("Periods", 20, 2, 300, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style");
Plot( BBandTop( P, Periods, Width ), "BBTop" + _PARAM_VALUES(), colorGold, Style ); 
Plot( BBandBot( P, Periods, Width ), "BBBot" + _PARAM_VALUES(), colorGold, Style ); 
_SECTION_END();


top1=BBandTop(p,20,2);
bot1=BBandBot(p,20,2);




Buy=(Cross(C,bot1));
Sell=(Cross(top1,C));


PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,Low,Offset=-15);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,High,Offset=-15);
try this

Code:
_SECTION_BEGIN("Bollinger_Bands_width");
pds=Param("Periods",20,2,200);
sd=Param("Band Width",2, 0.01,10);
alpha=2/(pds+1);
mt=AMA( C, alpha );
ut=AMA( mt, alpha );
dt=((2-alpha)*mt-ut)/(1-alpha);
mt2=AMA(abs(C-dt), alpha );
ut2=AMA(mt2,alpha );
dt2=((2-alpha)*mt2-ut2)/(1-alpha);
but=dt+sd*dt2;
blt=dt-sd*dt2;

Plot( but, "Upper band", colorLightGrey, styleLine | styleDots, maskAll );
Plot( blt, "Lower band", colorLightGrey, styleLine | styleDots, maskAll);
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

//Note:- If you change parameter of BBands then change manually also in Explorer, otherwise you will NOT get desire result.


_SECTION_BEGIN("Explorer");

bb= C > BBandTop( C, 20, 2) AND Ref (C,-1) < Ref(BBandTop( C, 20, 2),-1);
bb1= C < BBandBot( C, 20, 2) AND Ref (C,-1) > Ref(BBandBot( C, 20, 2),-1);
bb_status= WriteIf(BB, "AboveTop", WriteIf(bb1, "BelowBottom", "Neutral"));
bb_Col=IIf(bb, colorGreen, IIf(bb1, colorRed, colorLightGrey));


/* RESULTS */
Filter = MA(Volume,20) > 10000;
AddColumn( Close, "Close " );
AddColumn( Volume, "Volume " );
AddTextColumn(bb_status, "BBand", 1, colorWhite, bb_Col);

Buy = Cross(C , but);
Sell = Cross(blt , C);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
shape = Buy * shapeUpTriangle + Sell * shapeDownTriangle;
PlotShapes( shape, IIf( Buy, colorWhite, colorCustom12 ), IIf( Buy, Low, High ) );

_SECTION_END();

SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel color ",colorDarkGrey)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel color upper half", colorBlack),
ParamColor("Inner panel color lower half", colorDarkOliveGreen)); // color of inner panel
Title = EncodeColor(colorWhite)+ "BBW+SCAN+EXP By HULK" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V);
 
Hey, guys! How are you? Here I am again in need of some advice.

Well, I've been trying to put some conditions in my system, but its not working. Heres the code:



SetPositionSize( 1, spsShares );


ArrayMA = ParamField("Price field", 3 );
Periods = Optimize("MAPeriods", 26, 2, 60, 2 );
ProjectedMA = Ref( WMA( arrayma, periods -1) , -1);
Color = ParamColor("Color", colorCycle );
Style = ParamStyle("Style", styleLine | styleNoLabel);

CenterLine = WMA( ArrayMA, Periods );
Plot( CenterLine , "Média" , colorWhite);


//==================================================================================================================


//This is the Linear Regression Line.
//if it is Upward, I want to Buy in the touch of the MA.
//if it is Downward, I want to short in the touch of the MA.



per = Param( "LinPeriod", 61, 5, 100, 2);

mm = C;

x = Cum(1);
lastx = LastValue(x);
selv = SelectedValue(x);

aaa = LinRegIntercept(mm, per);
bbb = LinRegSlope(mm, per);

daa = SelectedValue(ValueWhen(x, aaa, 1));
dbb = SelectedValue(ValueWhen(x, bbb, 1));

xx = IIf(x > selv - per AND x <= selv, x - (selv - per),Null);

yy = daa + dbb * xx;

dhh = abs(H - yy);
dll = abs(L - yy);
dtt = Max(dhh,dll);

wd = SelectedValue(HHV(dtt,per));

SetChartOptions(0, chartShowDates);
GraphXSpace = 5;

Slope = bbb;
Colorchange = IIf(slope > 0, colorBlue, IIf(slope < 0, colorRed, colorWhite));

Plot(C,"",colorWhite,64);
Plot(yy, "LinReg", colorChange );
//Plot(yy + wd, "Upper Boundary", colorRed, 4 );
//Plot(yy - wd, "Lower Boundary", colorBrightGreen, 4 );


//==================================================================================================================


//Now for the buy and short signals.


//First the conditions. I want all 3 to be true at the same time to activate.

BuyCondSlope = slope > 0;

BuyCondMATouch = (Ref(Low , -1) > Ref( projectedMA , -1)) AND (Low < ProjectedMA);

BuyCondTimeLimit = TimeNum() >= 093000 AND TimeNum() <= 170000;


ShortCondSlope = slope < 0;

ShortCondMATouch = (Ref(High , -1) < Ref( ProjectedMA , -1)) AND (High > ProjectedMA);

ShortCondTimeLimit = TimeNum() >= 093000 AND TimeNum() <= 170000;



TickSize = 5;

BuyPrice = ProjectedMA;
ShortPrice = ProjectedMA;
Buy = BuyCondSlope AND BuyCondMATouch AND BuyCondTimeLimit;
Short = ShortCondSlope AND ShortCondMATouch AND ShortCondTimeLimit;

//Want to close any open position if its past 17h15m:
Sell = TimeNum() > 171500;
Cover = TimeNum() > 171500;

//Now I will activate the stop loss and take profit:

Stop_Mult = Optimize("StopMult" , 37 , 10 , 40 , 3);

StopLoss_Gain = Stop_Mult*TickSize;


ApplyStop(stopTypeLoss , stopModePoint , StopLoss_Gain , 1 , False , 0 );
ApplyStop(stopTypeProfit , stopModePoint , StopLoss_Gain , 1 , False , 0 );
And here are the problems:







EDIT: just to make it clear.

The question wasnt why the prices went up.

The question was why amibroker marked it as a buy, since it didnt fit in the buy conditions I set. The question is what did I put wrongly in my code so it set a buy while the linear regression was pointind down.

The conditions for a buy are:

1 - linear regression is pointing upward;
2 - prices are above the MA;
3 - prices touch the MA;

And the inverse for the short.



Somebody save me...

thanks!
 
Last edited:

cellclinic

Well-Known Member

amitrandive

Well-Known Member

cellclinic

I think you need this.You get the black background.You can customize to show previous day ,high low and also today's high low.

Code:
//ESSENTIAL TRADER TOOLS//

_SECTION_BEGIN("Price");
SetChartBkGradientFill( ParamColor("BgTop",colorBlack),ParamColor("BgBottom",colorBlack),ParamColor("Titleblock",colorLightGrey));
SetChartOptions(0,chartShowDates|chartShowArrows|chartLogarithmic|chartWrapTitle);
GraphXSpace = 5;
Plot(C,"",colorWhite,styleCandle);
_SECTION_END();

//Previous Days HI LO //

DayH = TimeFrameGetPrice("H", inDaily, -1);     DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1);     DayLI = LastValue (DayL,1);    // yesterdays low
DayC = TimeFrameGetPrice("C", inDaily, -1);         // yesterdays close
DayO = TimeFrameGetPrice("O", inDaily);            // current day open
DayH2= TimeFrameGetPrice("H", inDaily, -2);  DayH2I = LastValue (DayH2,1); // Two days before high
DayL2= TimeFrameGetPrice("L", inDaily, -2);  DayL2I = LastValue (DayL2,1);  // Two days before low
DayH3= TimeFrameGetPrice("H", inDaily, -3);  DayH3I = LastValue (DayH3,1);  // Three days before high
DayL3= TimeFrameGetPrice("L", inDaily, -3);  DayL3I = LastValue (DayL3,1);  // Three days before low

numbars = LastValue(Cum(Status("barvisible")));
hts  = -33.5;

YHL = ParamToggle("Yesterday HI LO","Show|Hide",1);
if(YHL==1) {
  Plot(DayL,"YL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(DayH,"YH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  PlotText(" YH " ,     LastValue(BarIndex())-(numbars/Hts), DayHI, colorTurquoise);
  PlotText(" YL " ,     LastValue(BarIndex())-(numbars/Hts), DayLI, colorTurquoise);
}

TDBHL = ParamToggle("2/3Days before HI LO","Show|Hide",0);
if(TDBHL==1) {
  Plot(DayL2,"2DBL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(DayH2,"2DBH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(DayL3,"3DBL",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(DayH3,"3DBH",colorTurquoise,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  PlotText(" 2DBH " ,     LastValue(BarIndex())-(numbars/Hts), DayH2I, colorTurquoise);
  PlotText(" 2DBL " ,     LastValue(BarIndex())-(numbars/Hts), DayL2I, colorTurquoise);
  PlotText(" 3DBH " ,     LastValue(BarIndex())-(numbars/Hts), DayH3I, colorTurquoise);
  PlotText(" 3DBL " ,     LastValue(BarIndex())-(numbars/Hts), DayL3I, colorTurquoise);
}

// Pivot Levels //
PP = (DayL + DayH + DayC)/3;  PPI = LastValue (PP,1);   // Pivot
R1  =  (PP * 2) - DayL;       R1I = LastValue (R1,1);   // Resistance 1
S1  =  (PP * 2)  - DayH;      S1I = LastValue (S1,1);   // Support 1
R2  =  PP + R1 - S1;          R2I = LastValue (R2,1);   // Resistance 2
S2  =  PP - R1 + S1;          S2I = LastValue (S2,1);   // Support 2
R3  =  PP + R2 - S1;          R3I = LastValue (R3,1);   // Resistance 3
S3  =  PP - R2 + S1;          S3I = LastValue (S3,1);   // Support 3

ppl = ParamToggle("Pivot Levels","Show|Hide",1);
if(ppl==1)  {
  Plot(PP, "PP",colorYellow,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(R1, "R1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(S1, "S1",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(R2, "R2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(S2, "S2",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(R3, "R3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
  Plot(S3, "S3",colorViolet,styleDots|styleNoLine|styleNoRescale|styleNoTitle);

  PlotText(" Pivot ",  LastValue(BarIndex())-(numbars/Hts), PPI, colorYellow);
  PlotText(" R1 " ,    LastValue(BarIndex())-(numbars/Hts), R1I, colorViolet);
  PlotText(" S1 " ,    LastValue(BarIndex())-(numbars/Hts), S1I, colorViolet);
  PlotText(" R2 " ,    LastValue(BarIndex())-(numbars/Hts), R2I, colorViolet);
  PlotText(" S2 " ,    LastValue(BarIndex())-(numbars/Hts), S2I, colorViolet);
  PlotText(" R3 " ,    LastValue(BarIndex())-(numbars/Hts), R3I, colorViolet);
  PlotText(" S3 " ,    LastValue(BarIndex())-(numbars/Hts), S3I, colorViolet);
}
// Camerilla Levels //

rg = (DayH - DayL);

H5=DayC+1.1*rg;     H5I = LastValue (H5,1);
H4=DayC+1.1*rg/2;   H4I = LastValue (H4,1);
H3=DayC+1.1*rg/4;   H3I = LastValue (H3,1);
H2=DayC+1.1*rg/6;   H2I = LastValue (H2,1);
H1=DayC+1.1*rg/12;  H1I = LastValue (H1,1);
L1=DayC-1.1*rg/12;  L1I = LastValue (L1,1);
L2=DayC-1.1*rg/6;   L2I = LastValue (L2,1);
L3=DayC-1.1*rg/4;   L3I = LastValue (L3,1);
L4=DayC-1.1*rg/2;   L4I = LastValue (L4,1);
L5=DayC-1.1*rg;     L5I = LastValue (L5,1);

pcl = ParamToggle("Camerilla Levels","Show|Hide",0);
if(pcl==1)  {
   Plot(H5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   Plot(H4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   Plot(H3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   Plot(H2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   Plot(H1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   Plot(L1,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   Plot(L2,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   Plot(L3,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   Plot(L4,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   Plot(L5,"",colorRose,styleDots|styleNoLine|styleNoRescale|styleNoTitle);
   PlotText(" H5 = " ,     LastValue(BarIndex())-(numbars/Hts), H5I  +0.05, colorRose);
   PlotText(" H4 = " ,     LastValue(BarIndex())-(numbars/Hts), H4I  +0.05, colorRose);
   PlotText(" H3 = " ,     LastValue(BarIndex())-(numbars/Hts), H3I  +0.05, colorRose);
   PlotText(" H2 = " ,     LastValue(BarIndex())-(numbars/Hts), H2I  +0.05, colorRose);
   PlotText(" H1 = " ,     LastValue(BarIndex())-(numbars/Hts), H1I  +0.05, colorRose);
   PlotText(" L1 = " ,     LastValue(BarIndex())-(numbars/Hts), L1I  +0.05, colorRose);
   PlotText(" L2 = " ,     LastValue(BarIndex())-(numbars/Hts), L2I  +0.05, colorRose);
   PlotText(" L3 = " ,     LastValue(BarIndex())-(numbars/Hts), L3I  +0.05, colorRose);
   PlotText(" L4 = " ,     LastValue(BarIndex())-(numbars/Hts), L4I  +0.05, colorRose);
   PlotText(" L5 = " ,     LastValue(BarIndex())-(numbars/Hts), L5I  +0.05, colorRose);
}

// Current Days Hi Lo //
THL = ParamToggle("Todays Hi Lo","Show|Hide",1);
if(THL==1)  {
  isRth = TimeNum() >= 084500 & TimeNum() <= 085959;
  isdRth = TimeNum() >= 084500 & TimeNum() <= 160000;
  aRthL = IIf(isRth, L, 1000000);
  aRthH = IIf(isdRth, H, Null);
  aRthLd = IIf(isdRth, L, 1000000);
  DayH = TimeFrameCompress( aRthH, inDaily, compressHigh );
  DayH = TimeFrameExpand( DayH, inDaily, expandFirst );
  DayL = TimeFrameCompress( aRthLd, inDaily, compressLow );
  DayL = TimeFrameExpand( DayL, inDaily, expandFirst );
  Bars = BarsSince(TimeNum() >= 94500 AND TimeNum() < 095959);//,BarIndex(),1); // AND DateNum()==LastValue(DateNum());
  x0 = BarCount-LastValue(Bars);
  x1 = BarCount-1;
  DayHline=LineArray(x0,LastValue(DayH),x1,LastValue (DayH),0);
  DayLline=LineArray(x0,LastValue(DayL),x1,LastValue (DayL),0);
  DayHlineI = LastValue (DayHline,1);
  DayLlineI = LastValue (DayLline,1);
  Plot(DayHline,"DayH",colorYellow,styleBar|styleNoRescale|styleNoTitle);
  Plot(DayLline,"DayL",colorYellow,styleBar|styleNoRescale|styleNoTitle);
  PlotText(" Day Hi " ,     LastValue(BarIndex())-(numbars/Hts), DayHlineI  +0.05, colorYellow);
  PlotText(" Day Lo " ,     LastValue(BarIndex())-(numbars/Hts), DayLlineI  +0.05, colorYellow);
 }
 

KelvinHand

Well-Known Member
Hey, guys! How are you? Here I am again in need of some advice.

Well, I've been trying to put some conditions in my system, but its not working. Heres the code:





And here are the problems:






Somebody save me...

thanks!
Let me blunt to you. Quite stupid to consider that the indicator/tool will work for you all the time. There are price action, supply n demand/support n resistance come into play that you are not consider. Your eye is your system.

When you see in 1min chart, did you correlate the higher timeframe ?
 

Similar threads