Failed to code my exit rule

mmca2006

Active Member
#1
My exit rule is if EOD closing above last week's high for long trade and for short trade if EOD closing below last week's low--but failed to code the AFL.
sell= c<??
cover=c>??
can any body help me , :thanx: in advance
 

mmca2006

Active Member
#3
sell = C > ref(H,-1);





cover = C < ref(L,-1);




This code will work here (on earth), but not sure it runs on saturn


Cheers
::thumb::
Code:
This code will work here (on earth), but not sure it runs on saturn
Ha ha ha ... nice one , but what you have stated that is for previous Day's high but My exit rule if EOD closing above last week's high.!! please share ur views.:)
 
#5
The above code works on a weekly chart and not daily ;)

For daily use the above by Johnny with one modification (use TimeFrameExpand) or try this

Code:
sell = TimeFrameGetPrice("C",inWeekly,0) > TimeFrameGetPrice("H",inWeekly,-1);
cover = TimeFrameGetPrice("C",inWeekly,0) < TimeFrameGetPrice("L",inWeekly,-1);
Cheers
::thumb::
 
#6
hi Johnny nice code but always use TimeFrameExpand for changing TF

HTML:
TimeFrameSet(inWeekly);
wh=H;
wl=L;
TimeFrameRestore();

Sell = C > TimeFrameExpand(ref(wh,-1),inWeekly);
Cover= C < TimeFrameExpand(ref(wl,-1),inWeekly);

Cheers
::thumb::
 

mmca2006

Active Member
#7
hope this will work

HTML:
TimeFrameSet(inWeekly);
wh=H;
wl=L;
TimeFrameRestore();

Buy=C>wh;
Sell=C<wl;
jhony bhai ,Thanks for the code , however I think it should be with little modification , I may be wrong--
Code:
TimeFrameSet(inWeekly);
wh=H;
wl=L;
TimeFrameRestore();
cover=C>Ref(wh,-1);
Sell=C<ref(wl,-1);
:)

cover= current closing if exceeds last week's high
sell= current closing if goes below last week's low
 

johnnypareek

Well-Known Member
#8
hi Johnny nice code but always use TimeFrameExpand for changing TF

HTML:
TimeFrameSet(inWeekly);
wh=H;
wl=L;
TimeFrameRestore();

Sell = C > TimeFrameExpand(ref(wh,-1),inWeekly);
Cover= C < TimeFrameExpand(ref(wl,-1),inWeekly);

Cheers
::thumb::

Hmm I guess expand need for ploting correctly. Anyways thanks for the same will keep in mind.

johnny
 

johnnypareek

Well-Known Member
#9
jhony bhai ,Thanks for the code , however I think it should be with little modification , I may be wrong--
Code:
TimeFrameSet(inWeekly);
wh=H;
wl=L;
TimeFrameRestore();
cover=C>Ref(wh,-1);
Sell=C<ref(wl,-1);
:)

cover= current closing if exceeds last week's high
sell= current closing if goes below last week's low
okay I assume its for EOD scan.

HTML:
TimeFrameSet(inWeekly);
wh=H;
wl=L;
TimeFrameRestore();
whh=TimeFrameExpand(wh,inWeekly);
wll=TimeFrameExpand(wl,inWeekly);
Buy=Cover=C>Ref(whh,-1);
Sell=Short=C<Ref(wll,-1);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Buy);
Plot(whh,"Weekly High",5,1);
Plot(wll,"Weekly Low",4,1);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorGreen, 0,L, Offset=-15); 
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-15);
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, High %g, Low %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", IIf( C>wh, colorGreen, IIf( C<wl, colorRed, colorBlack )), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();
 
Last edited:
#10
okay I assume its for EOD scan.

HTML:
TimeFrameSet(inWeekly);
wh=H;
wl=L;
TimeFrameRestore();
whh=TimeFrameExpand(wh,inWeekly);
wll=TimeFrameExpand(wl,inWeekly);
Buy=Cover=C>Ref(whh,-1);
Sell=Short=C<Ref(wll,-1);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Buy);
Plot(whh,"Weekly High",5,1);
Plot(wll,"Weekly Low",4,1);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorGreen, 0,L, Offset=-15); 
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-15);
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, High %g, Low %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", IIf( C>wh, colorGreen, IIf( C<wl, colorRed, colorBlack )), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();


Would u pls help to add Weekly Pivot point to above code.

Thanx you
 

Similar threads