5093
5093
com
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
//SetTradeDelays(1,1,1,1);
SetPositionSize(100,spsShares);
_SECTION_END();
NDays=Param("Number of Days",10,1,100,1);
DayC=TimeFrameGetPrice("C",inDaily,-1);
NDaysDHLAvg=0;
for(i=1;i<=NDays;i++)
{
DayH=TimeFrameGetPrice("H",inDaily,-i);
DayL=TimeFrameGetPrice("L",inDaily,-i);
NDaysDHLAvg=NDaysDHLAvg+(DayH-DayL);
}
NDaysDHLAvg=NDaysDHLAvg/NDays;
Buy= C>(DayC+(0.25*ADM));
Sell= C<(DayC-(0.25*ADM));
BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
BuyTarget1= (0.25*ADM)+BuyPrice;
BuyTarget2= (0.45*ADM)+BuyPrice;
BuyTarget3= (0.90*ADM)+BuyPrice;
BuyStopLoss= BuyPrice-(0.25*ADM);
SellTarget1= SellPrice-(0.25*ADM);
SellTarget2= SellPrice-(0.45*ADM);
SellTarget3= SellPrice-(0.90*ADM);
SellStopLoss= SellPrice+(0.25*ADM);
Cover=C<BuyStopLoss OR LastBar ;
Short=C>SellStopLoss OR LastBar;
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);
Buy=ExRem(Buy,Cover);
Cover=ExRem(Cover,Buy);
Sell=ExRem(Sell,Short);
Short=ExRem(Short,Sell);
Long=Flip(Buy,Cover);
Shrt=Flip(Sell,Short);
//---------------------------------------------------------------------------------
---------------
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy);
BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
Bdc=(
WriteIf (Buy AND Ref(shrt,-1), " BUY@ "+C+" ","")+
WriteIf(Buy , "LastTrade Profit="+(SellPrice-C)+"","")
);
Sdc=(
WriteIf (Sell AND Ref(Long,-1), " SEll@ "+C+" ","")+
WriteIf(Sell , "LastTrade Profit="+(C-BuyPrice)+"","")
);
Ndc=(
WriteIf(Long AND NOT Buy, "Long@"+WriteVal((BuyPrice))+" /Profit="+WriteVal((C-
BuyPrice))+"","")+
WriteIf(Shrt AND NOT Sell, "Short@"+WriteVal((SellPrice))+"
/Profit="+WriteVal((SellPrice-C))+"","")
);
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;
// Volatility Levels //
DC = DayC; DCI = LastValue (DC,1); // Yesterday
Close
BY = ((DayC)+((0.25)*(ADM))); BYI = LastValue (BY,1); // +1/4 ADM
BT1 = ((DayC)+((0.45)*(ADM))); BT1I = LastValue (BT1,1); // +1/2 ADM
BT2 = ((DayC)+((0.70)*(ADM))); BT2I = LastValue (BT2,1); // +3/4 ADM
BT3 = ((DayC)+(0.90*ADM)); BT3I = LastValue (BT3,1); // +1 ADM
SH = ((DayC)-((0.25)*(ADM))); SHI = LastValue (SH,1); // -1/4 ADM
ST1 = ((DayC)-((0.45)*(ADM))); ST1I = LastValue (ST1,1); // -1/2 ADM
ST2 = ((DayC)-((0.70)*(ADM))); ST2I = LastValue (ST2,1); // -3/4 ADM
ST3 = ((DayC)-(0.90*ADM)); ST3I = LastValue (ST3,1); // -1 ADM
_SECTION_BEGIN("Background text");
C11=ParamColor("up panel",colorBlack );
C12=ParamColor("dn panel",colorBlack );
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",8,1,30,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
GfxSetBkMode( 0 );
GfxSelectFont("Tahoma", 12, 500, False, False, 0);
GfxSetTextColor(colorCustom12);
GfxSetTextAlign( 6 );
GfxTextOut( "ADM (Average Daily Movement) "+WriteVal(ADM,1.2),
Status("pxwidth")/C14, Status("pxheight")/C15*1.5);
GfxSelectFont("Tahoma", 15, 600, False, False, 0);
GfxSetTextColor(colorWhite);
GfxSetTextAlign( 6 );
GfxTextOut( "LTP "+WriteVal(C,1.2), Status("pxwidth")/C14, Status("pxheight")/C15);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorBrightGreen);
GfxTextOut(""+Bdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.0);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorRed);
GfxTextOut(""+Sdc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.0);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorYellow);
GfxTextOut(""+Ndc+"", Status("pxwidth")/C14, Status("pxheight")/C15*2.0);
GfxSelectFont("Tahoma", 12, 400, False, False, 0);
GfxSetTextColor(colorGreen);
pricechange=(C-Ref(C,-1))*100/Ref(C,-1);
changeponit=C-Ref(C,-1);
Vlp=Param("Volume lookback period",15,10,300,10);
Vrg=MA(V,Vlp);
St = StDev(Vrg,Vlp);
Vp3 = Vrg + 3*st;
Vp2 = Vrg + 2*st;;
Vp1 = Vrg + 1*st;;
Vn1 = Vrg -1*st;
Vn2 = Vrg -2*st;
x=Param("xposn",1,0,1000,1);
y=Param("yposn",1,0,1000,1);
BuyTarget1= (0.25*ADM)+BuyPrice;
BuyTarget2= (0.45*ADM)+BuyPrice;
BuyTarget3= (0.70*ADM)+BuyPrice;
BuyStopLoss= BuyPrice-(0.25*ADM);
SellTarget1= SellPrice-(0.25*ADM);
SellTarget2= SellPrice-(0.45*ADM);
SellTarget3= SellPrice-(0.70*ADM);
SellStopLoss= SellPrice+(0.25*ADM);
//----------------------------------------------------------------Signals and
Targets----------------------------
//----------------------------------------------------------------Achieved Targets
and Stl----------------------------