Simple Coding Help - No Promise.

hi , and thanks for help , does anyone have ATR (Average True Range) original formula (source code) for ami, not ATR() , please source code thanks ,
 

KelvinHand

Well-Known Member
hi , and thanks for help , does anyone have ATR (Average True Range) original formula (source code) for ami, not ATR() , please source code thanks ,
PHP:
function  Original_Average_True_Range_Certified_TrueCopy_by_Kelvin_Own_Hand(Length)
{
 PreviousClose= Ref(Close, -1);
 TrueHigh = IIf( PreviousClose> High,   PreviousClose,  High);
 TrueLow = IIf( PreviousClose< Low,    PreviousClose,  Low);
 TrueRange=TrueHigh-TrueLow;
 return MA(TrueRange, Length) ;
}
 
Last edited:
PHP:
function  Original_Average_True_Range_Certified_TrueCopy_by_Kelvin_Own_Hand(Length)
{
 PreviousClose= Ref(Close, -1);
 TrueHigh = IIf( PreviousClose> High,   PreviousClose,  High);
 TrueLow = IIf( PreviousClose< Low,    PreviousClose,  Low);
 TrueRange=TrueHigh-TrueLow;
 return MA(TrueRange, Length) ;
}


:clapping: hi , my bro , , you are awesome , :thumb: ,thanks dear,can you send original source code of adx ? thanks man ,
 
Last edited:
Hi, I have problem where the trades reported in the backtest are not the same as the ones generated by my system. Pls help

Code:
_SECTION_BEGIN("Stochastic_smallerTF");
periods = Param( "Periods", 8, 1, 200, 1 );
Ksmooth = Param( "%K avg", 4, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
smallerTF= Param( "smallerTF", 1, 1, 10, 1 );

TimeFrameSet(in1Minute * smallerTF);
fast_Small_TF = StochK( periods , Ksmooth);
slow_Small_TF = StochD( periods , Ksmooth, DSmooth );
TimeFrameRestore();
 
fast_Small_TF_Value = TimeFrameExpand(fast_Small_TF , in1Minute * smallerTF);
slow_Small_TF_Value = TimeFrameExpand(slow_Small_TF , in1Minute * smallerTF);
 
//Plot(fast_Small_TF_Value , "Fast_S_"+smallerTF+"_TF", colorBlue, styleThick );
//Plot(slow_Small_TF_Value , "Slow_S_"+smallerTF+"_TF", colorGreen, styleThick );
 
 
_SECTION_BEGIN("Stochastic_LargerTF");
periods = Param( "Periods", 8, 1, 200, 1 );
Ksmooth = Param( "%K avg", 4, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );
largerTF= Param( "largerTF", 5, 2, 30, 1 );

 
TimeFrameSet(in1Minute * largerTF);
fast_Large_TF= StochK( periods , Ksmooth);
slow_Large_TF = StochD( periods , Ksmooth, DSmooth );
TimeFrameRestore();
 
fast_Large_TF_Value= TimeFrameExpand(fast_Large_TF, in1Minute * largerTF);
slow_Large_TF_Value= TimeFrameExpand(slow_Large_TF , in1Minute * largerTF);
 
//Plot(fast_Large_TF_Value, "Fast_L_"+largerTF+"_TF", colorRed, styleThick );
//Plot(slow_Large_TF_Value, "Slow_L_"+largerTF+"_TF", colorBlack, styleThick );

_SECTION_END();

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

StopLossPercentage=0.13;

Sell=0;
Cover=0;


SignalAfterPeriods=periods+Ksmooth +Dsmooth;

BuyCondition=Ref(fast_Large_TF_Value,-1)>Ref(slow_Large_TF_Value,-1) 
AND Ref(Cross(fast_Small_TF_Value,slow_Small_TF_Value),-1) 
AND Ref(fast_Small_TF_Value,-1)<25 AND Ref(slow_Small_TF_Value,-1)<25 AND BarIndex()>SignalAfterPeriods;

SellCondition=Ref(Cross(slow_Small_TF_Value,fast_Small_TF_Value),-1)  
AND Ref(fast_Small_TF_Value,-1)>70 AND Ref(slow_Small_TF_Value,-1)>70 AND BarIndex()>SignalAfterPeriods;

CoverCondition=Ref(Cross(fast_Small_TF_Value,slow_Small_TF_Value),-1) 
AND Ref(fast_Small_TF_Value,-1)<25 AND Ref(slow_Small_TF_Value,-1)<25 AND BarIndex()>SignalAfterPeriods;


Buy=BuyCondition AND TimeNum() > 93000 AND TimeNum() < 151000;


SellConditionTrue= BarsSince(SellCondition)>0 AND BarsSince(Buy)>BarsSince(SellCondition);


stopLossPriceForBuyPosition=ValueWhen(Buy,BuyPrice)-ValueWhen(Buy,BuyPrice)*StopLossPercentage/100;

Sell=IIf(SellConditionTrue AND L<Ref(L,-1),1,Sell);
Sell=IIf(BarsSince(Buy)<BarsSince(Sell) AND L<=stopLossPriceForBuyPosition,2,Sell); 
Sell=IIf(BarsSince(Buy)<BarsSince(Sell) AND TimeNum() >= 152000,3,Sell);
SellPrice=IIf(Sell==1 ,Ref(L,-1)-1,SellPrice);
SellPrice=IIf(Sell==2 ,stopLossPriceForBuyPosition,SellPrice);
SellPrice=IIf(Sell==3,O,SellPrice);


ShortCondition=SellCondition AND Ref(fast_Large_TF_Value,-1)<Ref(slow_Large_TF_Value,-1) 
AND Ref(ValueWhen(Sell,BarIndex()),-1)>=Ref(ValueWhen(Buy,BarIndex()),-1) AND BarIndex()>SignalAfterPeriods;

Short=ShortCondition AND TimeNum() > 93000 AND TimeNum() < 151000;

stopLossPriceForShortPosition=ValueWhen(Short,ShortPrice)+ValueWhen(Short,ShortPrice)*StopLossPercentage/100;

CoverConditionTrue=BarsSince(CoverCondition)>0 AND BarsSince(Short)>BarsSince(CoverCondition);

Cover=IIf(CoverConditionTrue AND H>Ref(H,-1),1,Cover);
Cover=IIf(BarsSince(Short)<BarsSince(Cover) AND H>=stopLossPriceForShortPosition,2,Cover);
Cover=IIf(BarsSince(Short)<BarsSince(Cover) AND TimeNum() >= 152000,3,Cover);
CoverPrice=IIf(Cover==1 ,Ref(H,-1)+1,CoverPrice);
CoverPrice=IIf(Cover==2,stopLossPriceForShortPosition,CoverPrice);
CoverPrice=IIf(Cover==3,O,CoverPrice);
//_TRACE("BarsSince(Short)!=0="+(BarsSince(Short)!=0)+", CoverCondition="+CoverCondition+", CoverConditionTrue="+CoverConditionTrue+", cover="+Cover);

//so that buy does not show up before cover
Buy=IIf((BarsSince(Cover)<=BarsSince(Short) OR (BarsSince(Cover)==0 AND BarsSince(Short)==0)),Buy,0);

BuyPrice=O;
ShortPrice=O;


Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy ); 

Short= ExRem( Short, Cover);
Cover = ExRem( Cover, Short);

//so that sell does not show up after short
Sell=IIf(BarsSince(Buy)<=BarsSince(Cover) AND NOT(BarsSince(Buy)==0 AND BarsSince(Short)==0 AND BarsSince(Cover)==0), Sell, 0);

BuyPrice=IIf(Buy==0,Null,BuyPrice);
SellPrice=IIf(Sell==0,Null,SellPrice);
ShortPrice=IIf(Short==0,Null,ShortPrice);
CoverPrice=IIf(Cover==0,Null,CoverPrice);

PlotShapes( shapeUpTriangle*IIf( Buy == 1, 1, 0 ), colorGreen, 0, L, -30 );

PlotShapes( shapeDownTriangle*IIf( Sell >=1 AND Sell<=3, 1, 0 ), colorGreen, 0, H, -30 );

PlotShapes( shapeUpTriangle*IIf( Cover >= 1 AND Cover<=3, 1, 0 ), colorRed, 0, L, -50 );

PlotShapes( shapeDownTriangle*IIf( Short == 1, 1, 0 ), colorRed, 0, H, -50 );

PositionSize = 50 * Close * 1.2;

//_TRACE("ATR(10)="+ATR(10));

_TRACE("Buy="+Buy+", Sell="+Sell+", Short="+Short+", cover="+Cover);



_TRACE("BuyCondition="+BuyCondition);
_TRACE("Ref(fast_Large_TF_Value,-1)>Ref(slow_Large_TF_Value,-1)="+(Ref(fast_Large_TF_Value,-1)>Ref(slow_Large_TF_Value,-1)));
_TRACE("Ref(Cross(fast_Small_TF_Value,slow_Small_TF_Value),-1)="+(Ref(Cross(fast_Small_TF_Value,slow_Small_TF_Value),-1))); 
_TRACE("Ref(fast_Small_TF_Value,-1)<25 AND Ref(slow_Small_TF_Value,-1)<25="+(Ref(fast_Small_TF_Value,-1)<25 AND Ref(slow_Small_TF_Value,-1)<25));
_TRACE("BarIndex()>SignalAfterPeriods="+(BarIndex()>SignalAfterPeriods));


//_TRACE("Buyprice="+BuyPrice+", Sellprice="+SellPrice+", Shortprice="+ShortPrice+", coverprice="+CoverPrice);
 
Hello sir,
Is it possible to scan for stocks that are above 60 RSI on monthly and weekly and in daily above 40. Similarly for sell side, the condition is, in monthly n weekly RSI should be below 40 n on daily RSI should be below 60. This is specifically for scanner. in scanner, if possible, we should be able to select the three timeframes like (monthly+weekly+daily) or (weekly+daily+hourly) n so on..


Also wanted to know if anyone can do scanner or AFL for hidden divergence with RSI ? To understand the difference between normal and hidden divergence, please refer the attached image.I found an afl for normal divergence. here is the code for that, may be it will help:

_SECTION_BEGIN("Divegence 2");
// ********************************************
// INDICATOR : Ultimate Divergence Detector
// DATE : 07-04-2014
// PROGRAMMER : Brad Konia
// COPYRIGHTS : Public Domain
// ********************************************

indName = "RSI"; // Specify the name of the indicator. This is cosmetic only.
length = Param(indName + " Length", 14, 8, 100, 1); // Indicator length
threshold = Param("Zig/Zag Threshold %", 10, 1, 50, 1); // Minimum % change in indicator value to be considered a zig/zag
indVal = RSI(length); // Load the indVal array with the values from the indicator of your choice
indZig = Zig(indVal, threshold); // Set the zig/zag values for the indicator
indPeakVal1 = Peak(indVal, threshold, 1); // Most recent peak value
indPeakBars1 = PeakBars(indVal, threshold, 1); // Bars since most recent peak
indPeakVal2 = Peak(indVal, threshold, 2); // Second most recent peak value
indPeakBars2 = PeakBars(indVal, threshold, 2); // Bars since second most recent peak
indTroughVal1 = Trough(indVal, threshold, 1); // Most recent trough value
indTroughBars1 = TroughBars(indVal, threshold, 1); // Bars since most recent trough
indTroughVal2 = Trough(indVal, threshold, 2); // Second most recent trough value
indTroughBars2 = TroughBars(indVal, threshold, 2); // Bars since second most recent trough

// Determine if current bar is a peak or trough
peakBar = indPeakBars1 == 0;
troughBar = indTroughBars1 == 0;

// Bearish divergence
divergeBear = IIf(peakBar AND (indPeakVal1 < indPeakVal2) AND High > Ref(High, -indPeakBars2), True, False);
Short = Ref(divergeBear, -1); // Enter short if the previous bar was a bearish divergence
Cover = Ref(troughBar, -1); // Cover short if the previous bar was a trough

// Bullish divergence
divergeBull = IIf((indTroughBars1 == 0) AND (indTroughVal1 > indTroughVal2) AND Low < Ref(Low, -indTroughBars2), True, False);
Buy = Ref(divergeBull, -1); // Enter long if the previous bar was a bullish divergence
Sell = Ref(peakBar, -1); // Close long if the previous bar was a peak

Plot(indVal, indName, colorGrey40);
Plot(indZig, "", colorWhite);
PlotShapes(IIf(peakBar OR troughBar, shapeCircle, shapeNone), colorGrey40, 0, indVal, 0);
PlotShapes(IIf(divergeBear, shapeCircle, shapeNone), colorRed, 0, indVal, 0);
PlotShapes(IIf(divergeBull, shapeCircle, shapeNone), colorBrightGreen, 0, indVal, 0);
_SECTION_END();



images for hidden divergence:

http://s29.postimg.org/t3rxivz3b/288xp2h.png
http://s29.postimg.org/vwg35st47/Down_Trend.png
http://s29.postimg.org/s07t6xeg7/Up_Trend.png

or

http://postimg.org/image/se956iyjn/
http://postimg.org/image/i2rqgr0ir/
http://postimg.org/image/ejauo244j/


hoping for someone to help
 
_SECTION_BEGIN("MarketProfile");
//------------------------------------------------------------------------------
//
// Formula Name: Market Profile
//
// Use with 5/15min chart
// Originial - From AFL library
// Edited by - Milind / KAKA

//Market Profile 10/12/2009


//------------------------------------------------------------------------------
// This is a modified version of afl date 09/19/2009 as listed above
// Contains a couple changes:
// 1) a more correct (but not complete) calculation of POC.
// 2) attempt to avoid the out of bound runtime error that
// sometimes occurs. See below:
//
// Here are changes to emulate the arrays x[] and total[] so
// that the array size are not limited by Barcount.
// Now one probably should not get the out of bound error even
// if the density or ticksize is smaller. Of course, there will
// be more overhead in calculation.
// johncw 20091010
// Wrapper start
_N(VarKey = NumToStr(GetChartID(), 1.0, False) + "_");
_N(VarTotal = "V_T" + VarKey);
_N(VarX = "V_x" + VarKey);

function L_StaticVarSet(L_name, L_value)
{
local L_name, L_value;
StaticVarSet(L_name + VarKey, L_value);
}

function L_StaticVarGet(L_name)
{
local L_name;
return(StaticVarGet(L_name + VarKey));
}

function x_g(L_idx)
{
local L_idx;
return VarGet(VarX + L_idx);
}

function x_s(L_idx, L_value)
{
local L_idx, L_value;
VarSet(VarX + L_idx, L_value);
}

function total_g(L_idx)
{
local L_idx;
return VarGet(VarTotal+L_idx);
}

function total_s(L_idx, L_value)
{
local L_idx, L_value, L_name;
VarSet(VarTotal+L_idx, L_value);
}
// Wrapper end
//------------------------------------------------------------------------------


PlotOHLC(O,H,L,C,"Price",IIf(C>O,colorGreen,colorRed),styleCandle);


EnMP2= ParamList("MarketProfile","Solid|Lines|Letters");
styleLines = ParamStyle("Style", styleLine, maskAll);

Type=ParamList("Type","Price Profile|Volume Profile");
Period= ParamList("Base","Hourly|Daily|Weekly|Monthly|Yearly",1);

Den = Param("Density", 1, 0.25, 100, 0.25); // Resolution in terms of $
percent=Param("Value Area", 70, 1, 100, 1);
ViewTPOCount= ParamToggle("Show TPO Count", "No|Yes",1);
Viewvalues= ParamToggle("Show Values", "No|Yes",1);

ViewPREVIOUS = ParamToggle("Previous Values", "No|Yes",1);

ViewVALVAH = ParamToggle("Show VAL VAH Line", "No|Yes",1);
Viewfill = ParamToggle("Show VA Fill", "No|Yes",0);
Colorpoc=ParamColor("Color POC", colorYellow);
Colorfill=ParamColor("Color Fill", ColorRGB(20,40,60));


EnIB = ParamToggle("Show Initial Balance", "Yes|No");
IBBars = Param("Initial Balance Bars", 2, 0, 10, 1);

if(Period=="Daily"){
BarsInDay = BarsSince(Day() != Ref(Day(), -1));
Bot = TimeFrameGetPrice("L", inDaily, 0);
Top = TimeFrameGetPrice("H", inDaily, 0);
Vol = TimeFrameGetPrice("V", inDaily, 0);
}

if(Period=="Hourly"){
BarsInDay = BarsSince(Minute() != Ref(Minute(), -1));
Bot = TimeFrameGetPrice("L", in5Minute, 0);
Top = TimeFrameGetPrice("H", in5Minute, 0);
Vol = TimeFrameGetPrice("V", in5Minute, 0);
}

if(Period=="Weekly"){
BarsInDay = BarsSince(DayOfWeek() < Ref( DayOfWeek(), -1 ));
Bot = TimeFrameGetPrice("L", inWeekly, 0);
Top = TimeFrameGetPrice("H", inWeekly, 0);
Vol = TimeFrameGetPrice("V", inWeekly, 0);
}

if(Period=="Monthly" ){
BarsInDay = BarsSince(Month() != Ref(Month(), -1));
Bot = TimeFrameGetPrice("L", inMonthly, 0);
Top = TimeFrameGetPrice("H", inMonthly, 0);
Vol = TimeFrameGetPrice("V", inMonthly, 0);
}

if(Period=="Yearly" ){
BarsInDay = BarsSince(Year() != Ref(Year(), -1));
Bot = TimeFrameGetPrice("L", inYearly, 0);
Top = TimeFrameGetPrice("H", inYearly, 0);
Vol = TimeFrameGetPrice("V", inYearly, 0);
}

CurTop = HHV(H,BarsInDay+1);
Curbot = LLV(L,BarsInDay+1);
Range = Highest(Top-Bot);
TodayRange = Top - Bot;

AveRange = Sum(Top-Bot,30)/30;
LAveRange = AveRange[BarCount-1];

// Initialization
baseX = 0;
baseY = floor(Bot[0]/Den)*Den;
relTodayRange = 0;
firstVisBar = Status("firstvisiblebar");
lastVisBar = Status("lastvisiblebar");

D=.0005;
//total=0;
totaldn=0;
totalup=0;
shiftup=0;
shiftdn=0;
startr=0;

i0 = 0;
i1 = 0;
for (i=0; i<BarCount; i++) {
x_s(i, 0); // should not need this
if (BarsInDay == 0 AND i < firstVisBar) {
i0 = i;
}
if (BarsInDay == 0 AND i >= lastVisBar) {
i1 = i;
}
}

i1 = BarCount-1;
for (i=i0; i<=i1; i++) {
if (BarsInDay == 0) {
baseX = i;
baseY = floor(Bot/Den)*Den;
maxY = floor(Top/Den)*Den;
relTodayRange = (maxY-baseY)/Den;

for (j=0; j <= relTodayRange; j++) {
x_s(j, 0);

}
}

range_x=lastVisBar-firstVisBar;
spread = Param("X Space", 80, 1, 200, 1);
tpl = Param("Time Per Letter (mins)", 30, 1, 360, 1);
Intervalmin=Interval()/60;
flt =Param("First Letter (Bars)", 1, 1, 60, 1);
teb=ParamToggle("To Each Bar","No|Yes");
Color=Param("Color Threshold",20,1,50,1);
stopg=0;
stopr=0;
new=0;

Voloumeunit=Vol/LastValue(BarsInDay);


if (EnMP2 == "Letters") {
for (j=0; j<= relTodayRange; j++) {
if (L <= baseY+j*Den AND H >= baseY+j*Den) {
PlotText(StrExtract(" A , B , C , D , E , F , G , H , I , J , K , L , M , N , O , P , Q , R , S , T , U , V , W , X , Y , Z, a , b , c , d , e , f , g , h , i , j , k , L , m , n ,o , p , q , r , s , t , u , v , w , x , y , z ",
IIf(BarsInDay<flt,0,ceil(BarsInDay/(tpl/Intervalmin))-0)), baseX+IIf(teb==1,BarsInDay,x_g(j)*(range_x/spread)), baseY+j*Den,
colorWhite,ColorHSB(10+((ceil(BarsInDay/(tpl/Intervalmin)))*Color),160,140));
x_s(j, x_g(j)+1);

}
}
}

else if (EnMP2 == "Lines" OR EnMP2 == "Solid") {
for (j=0; j<= relTodayRange; j++) {
if (L <= baseY+j*Den AND H >= baseY+j*Den) {
if(Type=="Price Profile"){x_s(j, x_g(j)+1);}
else if(Type=="Volume Profile"){x_s(j, x_g(j)+round(V/Voloumeunit));}

}
}
}

// Draw Initial Balance after 11am bar is complete
if (BarsInDay == IBBars+1 AND EnIB == 0) {
Line1 = LineArray(i-2, curtop[i-1],i+7, curtop[i-1],0,True);
Plot(Line1,"",colorLightGrey,styleLine+styleDashed|styleNoRescale);
Line1 = LineArray(i-2, curbot[i-1],i+7, curbot[i-1],0,True);
Plot(Line1,"",colorLightGrey,styleLine+styleDashed|styleNoRescale);
}

// Examine x[j]
if ((i < BarCount - 1 AND BarsInDay[i+1] == 0) OR i == BarCount-1) {
maxXj = 0;
maxj = 0;
midrange = int(relTodayRange/2)+1;
for (j=0; j<= relTodayRange; j++) {
if (maxXj < x_g(j)) {
maxXj = x_g(j); maxj = j; L_StaticVarSet("Maxj",j); new=j;
} else if ( MaxXj == x_g(j)) {
if (abs(midrange-j) < abs(midrange-L_StaticVarGet("Maxj"))) {
maxXj = x_g(j); maxj = j; L_StaticVarSet("Maxj",j); new=j;
}
}
}
total_s(0, 0);
for ( n = 1; n <= relTodayRange; n++ ) {
total_s(n, x_g(n) + total_g(n-1));
}

Value_area=(total_g(relTodayRange)*percent)/100;

for ( a = 1; a <= relTodayRange; a++ )
{
if(Maxj-a>0 AND Maxj+a<relTodayRange)
{
if(MaxXj+total_g(Maxj+a)-total_g(Maxj)+(total_g(maxj)-MaxXj)-total_g(Maxj-(a+1))>=Value_area) {shiftup=a; shiftdn=a; break;}
}
else if(Maxj-a<1 )
{
if(MaxXj+total_g(Maxj+a)-total_g(Maxj)+(total_g(maxj)-MaxXj)>=Value_area){shiftup=a; shiftdn=maxj-1; break;}
}
else if(Maxj+a>relTodayRange )
{
if(MaxXj+total_g(relTodayRange)-total_g(Maxj)+(total_g(maxj)-MaxXj)-total_g(Maxj-(a+1)) >=Value_area){shiftup=relTodayRange-maxj; shiftdn=a; break;}
}
}

Vah = LineArray(baseX, baseY+(maxj+shiftup)*Den, i, baseY+(maxj+shiftup)*Den,0,True);
Val = LineArray(baseX, baseY+(maxj-shiftdn)*Den, i, baseY+(maxj-shiftdn)*Den,0,True);
Vah1 = LineArray(i, baseY+(maxj+shiftup)*Den, i+BarsInDay, baseY+(maxj+shiftup)*Den,0,True);
Val1 = LineArray(i, baseY+(maxj-shiftdn)*Den, i+BarsInDay, baseY+(maxj-shiftdn)*Den,0,True);
poc = LineArray(baseX, baseY+maxj*Den, i, baseY+maxj*Den,0,True);
poc1 = LineArray(i, baseY+maxj*Den, i+BarsInDay, baseY+maxj*Den,0,True);

if(ViewVALVAH==1)
{
Plot(Vah,"",ParamColor("Color_VA", colorBlueGrey),styleLine|styleNoRescale);
Plot(Val,"",ParamColor("Color_VA", colorLightBlue),styleLine|styleNoRescale);
Plot(poc,"",Colorpoc,styleLine|styleNoRescale);
}
if(ViewPREVIOUS==1)
{
Plot(Vah1,"",ParamColor("Color_VA", colorBlueGrey),styleDashed|styleNoRescale);
Plot(Val1,"",ParamColor("Color_VA", colorLightBlue),styleDashed|styleNoRescale);
Plot(poc1,"",Colorpoc,styleDashed|styleNoRescale);
}


if(Viewvalues==1)
{
PlotText(""+(baseY+maxj*Den),i-5,baseY+maxj*Den,Colorpoc);
PlotText(""+(baseY+(maxj+shiftup)*Den),i-5,baseY+(maxj+shiftup)*Den,colorWhite);
PlotText(""+(baseY+(maxj-shiftdn)*Den),i-5,baseY+(maxj-shiftdn)*Den,colorWhite);
if(ViewTPOCount==1){PlotText(""+(total_g(maxj)-MaxXj)+" / "+(total_g(maxj-shiftdn-1)),basex,bot-(Top-bot)*0.05,ParamColor("Color_Below_VA", colorGrey40));
PlotText(""+(total_g(relTodayRange)-total_g(maxj))+" / "+(total_g(relTodayRange)-total_g(maxj+shiftup)),basex,Top,ParamColor("Color_Above_VA", colorGrey40));
}



}

}

if (i < BarCount - 1 AND BarsInDay[i+1] == 0 OR i == BarCount-1) {

for (p = 1; p < relTodayRange+1; p++){
line = LineArray(baseX, baseY+p*Den, baseX+x_g(p), baseY+p*Den);
line2 = LineArray(baseX, baseY+(p-1)*Den, baseX+x_g(p-1), baseY+(p-1)*Den);

if (EnMP2 == "Solid")
{
PlotOHLC( Line, Line, Line2, Line2, "",IIf(p>(maxj+shiftup),ParamColor("Color_Above_VA", colorGrey40),IIf(p<=(maxj+shiftup)AND p>(maxj-shiftdn),ParamColor("Color_VA", colorBlueGrey),ParamColor("Color_Below_VA", colorGrey40))) ,styleCloud|styleNoRescale|styleNoLabel);
}
if (EnMP2 == "Lines")
{
Plot(line,"",IIf(p>(maxj+shiftup),ParamColor("Color_Above_VA", colorGrey40),IIf(p<=(maxj+shiftup)AND p>(maxj-shiftdn),ParamColor("Color_VA", colorBlueGrey),ParamColor("Color_Below_VA", colorGrey40))) , styleLines|styleNoLabel);
}

}
if(Viewfill==1){PlotOHLC(Vah,Vah,Val,Val,"",Colorfill,styleCloud|styleNoRescale|styleNoLabel);}

}
}


_SECTION_END();


Sir n seniors....this is market profile afl which has parameter of DAily,weekly,monthly and yearly...sir i need it for half yearly and 3 months ...plz look for it.....
 

Similar threads