Trading as a part time profession.

Status
Not open for further replies.

rajendrani

Well-Known Member
rajendrani can u upload the MP afl really ur charts are lookin good
MP afl
Code:
_SECTION_BEGIN("MarketProfile");
//------------------------------------------------------------------------------
//
//  Formula Name:    Market Profile 
//
// Use with 5/15min chart
// Originial - From AFL library
// Edited by - Milind

//Market Profile


Den = Param("Density", 1, 0.25, 100, 0.25); // Resolution in terms of $
IBBars = Param("Initial Balance Bars", 2, 0, 5, 1);
EnIB = Param("Show Initial Balance", 1, 0, 1, 1);
EnMP = Param("Show Market Profile", 1, 0, 2, 1);

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

BarsInDay = BarsSince(Day() != Ref(Day(), -1));
Bot = TimeFrameGetPrice("L", inDaily, 0);
Top = TimeFrameGetPrice("H", inDaily, 0);
Vol = TimeFrameGetPrice("V", inDaily, 0);
POC = H - H;
VAL = H - H;
VAH = H - H;
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];
if (LAveRange < 1) {Den = 0.05;}
else if (LAveRange < 10) {Den = 0.25;}
else if (LAveRange < 20) {Den = 0.5;}
else if (LAveRange < 100) {Den = 1;}
else if (LAveRange < 500) {Den = 5;}
else {Den = 1;}

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

D=.0005;

for (j=0; j <= 100; j++) {
  x[j] = 0;
}

i0 = 0;
i1 = 0;
for (i=0; i<BarCount; i++) {
  if (BarsInDay[i] == 0 AND i < firstVisBar) {
    i0 = i;
  }
  if (BarsInDay[i] == 0 AND i >= lastVisBar) {
    i1 = i;
  }
}

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

    for (j=0; j <= relTodayRange; j++) {
      x[j] = 0;
    }
  }

  if (EnMP == 2) {
    for (j=0; j<= relTodayRange; j++) {
      if (L[i] <= baseY+j*Den AND H[i] >= baseY+j*Den) {
	PlotText(StrExtract("A,B,C,D,E,F,G,H,I,J,K,L,M,N",
                 BarsInDay[i]), baseX+x[j], baseY+j*Den, colorBlack);
        x[j]++;
      }
    }
  }
  else if (EnMP == 1) {
    for (j=0; j<= relTodayRange; j++) {
      if (L[i] <= baseY+j*Den AND H[i] >= baseY+j*Den) {
	line = LineArray(baseX, baseY+j*Den, baseX+x[j]+1, baseY+j*Den);
	Plot(line,"",ParamColor("Color", colorGold), styleLine+styleDots);
        x[j]++;
      }
    }
  }  

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

  // Examine x[j]
  if ((i < BarCount - 1 AND BarsInDay[i+1] == 0) OR i == BarCount-1) {
    maxXj = 0;
    for (j=0; j<= relTodayRange; j++) {
      if (maxXj < x[j]) {maxXj = x[j]; maxj = j;}
    }
    for (k=i-BarsInDay[i];k<=i;k++) {
      POC[k] = baseY+Maxj*Den;
    }
    Line1 = LineArray(baseX, baseY+maxj*Den, i, baseY+maxj*Den,0,True);
    Line1a=Line1+d*Line1;
    Line1b=Line1-d*Line1;
    Plot(Line1,"",colorWhite,styleDots+styleThick);
    Plot(Line1a,"",colorWhite,styleDots+styleThick);
    Plot(Line1b,"",colorWhite,styleDots+styleThick);

  }
}

Plot(POC,"POC",colorBlack,styleDots);
_SECTION_END();

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | styleHidden | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();
 

pleaseharsh

Well-Known Member
hello raj...
again few doubts from my side....
1) no 3. arrow showing long trade !!! on wt basis did u take that long trade ...sort of resting bar concept ? cuz i can see long at a prev ph just before yr long entry...shouldn't it be that ph+sf ?
2) no 6. arrow showing short entry .....pls explain this short entry as i dont see any pl...

is it because in both the above case it is a sort of situation of adjacent ph,pl side by side...(though in both case the trade entry bar made ph and pl respectively ; sort of)

regards
harsh
 

rajendrani

Well-Known Member
hello raj...
again few doubts from my side....
1) no 3. arrow showing long trade !!! on wt basis did u take that long trade ...sort of resting bar concept ? cuz i can see long at a prev ph just before yr long entry...shouldn't it be that ph+sf ?
2) no 6. arrow showing short entry .....pls explain this short entry as i dont see any pl...

is it because in both the above case it is a sort of situation of adjacent ph,pl side by side...(though in both case the trade entry bar made ph and pl respectively ; sort of)

regards
harsh
Dear Harsh,
This trading was not based on the 5 min pivot method, this was just by purely trendline basis considering the bar which touches the trendlines and using that bar low or high as the basis for entry or sar. Well this was just kind of experiment where we would try to get an early entry and a good exit to the trade. But this again comes with their another set of disadvantages too. Please wait for my another post of the trade where I will point the trendline and also the pivot trading combined together and which will also help to find the good profit booking levels

No 3 and No 6 surely doesnt gives the level as per PH this is with breaking of the trendline.

My next post will be on to make this level as the profit booking level and changing it to SAR at the pivot level. Wait till I post my next post, you will definately get an over view as to how this level can be considered as SAR and also as Profit booking level.

Regards,
Rajendrani
 

rajendrani

Well-Known Member


Dear Harsh, check this pic, now you would be very clear on the pivot trading and these trendlines drawn on the two pivots really can give more information. Now how to use those trendlines and how this can be really useful. For that you have to wait for my detailed post on that, for which again time is a constaint for me. But as soon as I get time for the same, I will definately post on how to use these trendlines.

Thanks and regards,
rajendrani
 
Last edited:
Status
Not open for further replies.