Simple Coding Help - No Promise.

josh1

Well-Known Member
Sir just change the 42nd line in code
this
Code:
GfxGradientRect( 21,41,220, 220  , colorAqua, colorAqua ); // the Chassis Box
to this
Code:
GfxGradientRect( 21,41,220, Param("lower height",100,1,1000,1)  , colorAqua, colorAqua ); // the Chassis Box
:)
Thank you. That takes care of 1st point. Now it remains to see whether we can something to increase font by replacing line 282. However, that is not urgent.
 

RadhuK

Well-Known Member
Hope this helps. Thnx.
Code:
_SECTION_BEGIN("High Low of Start End Time");
tn = TimeNum();
StartTime = Paramtime("Define Start Time","12:44:59",0);
EndTime = Paramtime("Define End Time","12:59:59",0);
StartBar = tn == StartTime;
EndBar = tn == Endtime;
Barhigh = ValueWhen(EndBar, Highestsince(StartBar, High));
Barlow = ValueWhen(EndBar, Lowestsince(StartBar, Low));

GfxSetBkMode( 1 );
GfxSelectFont("Courier New", 8, 700 );
GfxSetTextColor( colorGold );
GfxTextOut(" H-"+Barhigh +" & L-"+BarLow, 5,10);
GfxTextOut("/ Between Time -"+StartTime+" & "+EndTime,140,10);
_SECTION_END();
NF TIME.png

I am afraid this does not work. Shows zero values

I tried following but no luck.
StartTime = Hour()==12 AND Minute()==45 ; //Paramtime("Define Start Time","12:44:59",0);
EndTime = Hour()==13 AND Minute()==0 ; // Paramtime("Define End Time","12:59:59",0);

Please tell me how to find high low during this time period.
Regards
 
View attachment 37177
I am afraid this does not work. Shows zero values

I tried following but no luck.
StartTime = Hour()==12 AND Minute()==45 ; //Paramtime("Define Start Time","12:44:59",0);
EndTime = Hour()==13 AND Minute()==0 ; // Paramtime("Define End Time","12:59:59",0);

Please tell me how to find high low during this time period.
Regards
@RadhuK - Below is the pic of just price and my given code, which shows the value of High and Low at your requested time. Thnx
High Low of Start End Time Pic.png
 

josh1

Well-Known Member
C-like:
_SECTION_BEGIN("Open Range Breakout");

xf = ParamList("TF","5M|10M|15M|30M|H",2);
ShowORB = ParamToggle("Show Opening Range", "Show|Hide", 1);

if(ShowORB == 1)
{
SetBarsRequired(-2,-2); //Turn Quick AFL Off

spacer = IIf(xf == "5M",500,IIf(xf == "10M",1000,IIf(xf == "15M",1500,IIf(xf == "30M",3000,IIf(xf == "H",6000,1)))));
tf = IIf(xf == "5M",300,IIf(xf == "10M",600,IIf(xf == "15M",900,IIf(xf == "30M",1800,IIf(xf == "H",6000,1)))));

newday = Day() != Ref(Day(),-1);  //check if new day or
starttime = ValueWhen(newday,TimeNum());

IBendtime = starttime+spacer;
minh = ValueWhen(newday,TimeFrameGetPrice("H",tf));
minl = ValueWhen(newday,TimeFrameGetPrice("L",tf));

printf("%g",IBendtime);
ORBH = IIf(TimeNum() < IBendtime, Null ,minh);
ORBL = IIf(TimeNum() < IBendtime, Null, minl);
Rangehi = LastValue(ORBH);
Rangelo = LastValue(ORBL);
Plot(ORBH,"ORBH",ParamColor("ORH",colorYellow),styleNoTitle);
Plot(ORBL,"ORBL",ParamColor("ORL",colorYellow),styleNoTitle);
PlotOHLC(ORBL,ORBH,ORBL,ORBH,"ORB",ParamColor("OR",colorGrey40),styleCloud|styleNoLabel|styleNoTitle,0,0,0,-1);

Filter = Param("Filter",5,0,100,0.01,0);

UT = Ref(C,-1)> Rangehi+Filter;
DT = Rangelo-Filter > Ref(C,-1);

Hor=Param("Horizontal Position",500,1,1200,1);
Ver=Param("Vertical Position",1,1,830,1);
FS=Param("Font Size Trend",34,11,100,1);
//T= ParamList("Trend", "Select Trend|Sideways|Short Only|Long Only");
GfxSetBkMode( 1 );
GfxSelectFont( "Arial", FS, 700, italic = False, underline = False, True );
GfxSetTextColor(ParamColor("ColorTrend",colorWhite) );
GfxSetOverlayMode( mode = 1 );
IIf(UT,GfxTextOut("minor Up Trend "+UT , Hor,Ver ),IIf(DT,GfxTextOut( "minor Down Trend " + DT , Hor,Ver+20 ),GfxTextOut( "Sideways", Hor,Ver+40 )) );

}

_SECTION_END();
Can anybody tell me what is wrong with last iif statement in the baove code? I am getting all the three options printed in chart.
Capture.PNG
 
C-like:
_SECTION_BEGIN("Open Range Breakout");

xf = ParamList("TF","5M|10M|15M|30M|H",2);
ShowORB = ParamToggle("Show Opening Range", "Show|Hide", 1);

if(ShowORB == 1)
{
SetBarsRequired(-2,-2); //Turn Quick AFL Off

spacer = IIf(xf == "5M",500,IIf(xf == "10M",1000,IIf(xf == "15M",1500,IIf(xf == "30M",3000,IIf(xf == "H",6000,1)))));
tf = IIf(xf == "5M",300,IIf(xf == "10M",600,IIf(xf == "15M",900,IIf(xf == "30M",1800,IIf(xf == "H",6000,1)))));

newday = Day() != Ref(Day(),-1);  //check if new day or
starttime = ValueWhen(newday,TimeNum());

IBendtime = starttime+spacer;
minh = ValueWhen(newday,TimeFrameGetPrice("H",tf));
minl = ValueWhen(newday,TimeFrameGetPrice("L",tf));

printf("%g",IBendtime);
ORBH = IIf(TimeNum() < IBendtime, Null ,minh);
ORBL = IIf(TimeNum() < IBendtime, Null, minl);
Rangehi = LastValue(ORBH);
Rangelo = LastValue(ORBL);
Plot(ORBH,"ORBH",ParamColor("ORH",colorYellow),styleNoTitle);
Plot(ORBL,"ORBL",ParamColor("ORL",colorYellow),styleNoTitle);
PlotOHLC(ORBL,ORBH,ORBL,ORBH,"ORB",ParamColor("OR",colorGrey40),styleCloud|styleNoLabel|styleNoTitle,0,0,0,-1);

Filter = Param("Filter",5,0,100,0.01,0);

UT = Ref(C,-1)> Rangehi+Filter;
DT = Rangelo-Filter > Ref(C,-1);

Hor=Param("Horizontal Position",500,1,1200,1);
Ver=Param("Vertical Position",1,1,830,1);
FS=Param("Font Size Trend",34,11,100,1);
//T= ParamList("Trend", "Select Trend|Sideways|Short Only|Long Only");
GfxSetBkMode( 1 );
GfxSelectFont( "Arial", FS, 700, italic = False, underline = False, True );
GfxSetTextColor(ParamColor("ColorTrend",colorWhite) );
GfxSetOverlayMode( mode = 1 );
IIf(UT,GfxTextOut("minor Up Trend "+UT , Hor,Ver ),IIf(DT,GfxTextOut( "minor Down Trend " + DT , Hor,Ver+20 ),GfxTextOut( "Sideways", Hor,Ver+40 )) );

}

_SECTION_END();
Can anybody tell me what is wrong with last iif statement in the baove code? I am getting all the three options printed in chart.
@josh1: Sir, just change your last "iif" with the following. Thnx

Code:
text = WriteIf(UT,"minor Up Trend ",WriteIf(DT, "minor Down Trend ", "Sideways" ));
GfxTextOut(text,Hor,Ver);
 

josh1

Well-Known Member
@josh1: Sir, just change your last "iif" with the following. Thnx

Code:
text = WriteIf(UT,"minor Up Trend ",WriteIf(DT, "minor Down Trend ", "Sideways" ));
GfxTextOut(text,Hor,Ver);
Wow.. Thanks. Please don't call me 'Sir' . All members are equal here.

Guess, I should be able to solve my issue in Post #5918 also with code similar to these two lines code.
 
@josh1: Sir, just change your last "iif" with the following. Thnx

Code:
text = WriteIf(UT,"minor Up Trend ",WriteIf(DT, "minor Down Trend ", "Sideways" ));
GfxTextOut(text,Hor,Ver);
Nice simple solution :up:

@josh1 ji

If you want to use multiple GfxTextOut statements or
some other calculations etc based on these same condition
instead of IIf, can use if else if

as arrays cannot be used in these conditional statements,
we have to use LastValue // SelectedValue for e.g.
can write the above code as
Code:
       if(SelectedValue(UT))    GfxTextOut("Minor  Up  Trend " + UT , Hor,Ver );
else   if(SelectedValue(DT))    GfxTextOut("Minor Down Trend " + DT , Hor,Ver+20 );
else                            GfxTextOut("Sideways", Hor,Ver+40);
.
 

Similar threads