AFL expert plz help me

#1
Hi anybody can help me to solve this problem .....
I want to view below calculation like Open , High , Low , close on the top of the chart bar by bar ....

(High - Low)/( High + Low )/2 *100


plz help me .....

Regards
TheMarketKid :)
 
Last edited:

KelvinHand

Well-Known Member
#2
Hi anybody can help me to solve this problem .....
I want to view below calculation like Open , High , Low , close on the top of the chart bar by bar ....

(High - Low)/( High + Low )/2 *100


plz help me .....

Regards
TheMarketKid :)
Code:
_SECTION_BEGIN("Price Chart");

bgTop = ParamColor("BgTop",    colorBlack);
bgBot = ParamColor("BgBottom", colorBlack);
SetChartBkGradientFill( bgTop ,bgBot, colorLightGrey);

SetChartOptions(0,chartShowArrows|chartShowDates);

TheMarketKid = 100*(High - Low)/( High + Low )/2;

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open=%g, High=%g, Low=%g, Close=%g (%.2f%%) {{VALUES}}", O, H, L, C, TheMarketKid ));


Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 


_SECTION_END();
 

pkgmtnl

Well-Known Member
#3
Hello,
I am not able to explore the expected results.

I want to explore in first / two minutes of market for the scripts which has opened above / low of Yesterday Price.

Please suggest correction

TimeFrameSet(inDaily);
a11=H;
a12=L;
TimeFrameRestore();

DayH = TimeFrameGetPrice("H", inDaily, -1); DayHI = LastValue (DayH,1);// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1); DayLI = LastValue (DayL,1); // yesterdays low
DayHT= TimeFrameGetPrice("H", inDaily);
DayLT = TimeFrameGetPrice("L", inDaily);

a1 = O>a11;
b1 = O>a12;
Buy=a1;
Sell=b1;
Filter = Buy OR Sell;


AddColumn( C, "CMP", 1.2, textColor = colorBlack, bkgndColor = colorLightYellow,70 );

Please guide.
 
#4
Code:
_SECTION_BEGIN("Price Chart");

bgTop = ParamColor("BgTop",    colorBlack);
bgBot = ParamColor("BgBottom", colorBlack);
SetChartBkGradientFill( bgTop ,bgBot, colorLightGrey);

SetChartOptions(0,chartShowArrows|chartShowDates);

TheMarketKid = 100*(High - Low)/( High + Low )/2;

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open=%g, High=%g, Low=%g, Close=%g (%.2f%%) {{VALUES}}", O, H, L, C, TheMarketKid ));


Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 


_SECTION_END();





thanks KelvinHand for your kind help .......

I have one more problem hope you 'll also guide me .......

Could you make an AFL which can plot previous day closing price with a horizontal line on next day chart ...so we can figure out which stocks are up & down from previous day price ......

Now I have done this manually by plotting a Horizontal line bt problem is that I could not do this automatic way with help of any AFL .....







regards
TheMarketKid:)
 
Last edited:

KelvinHand

Well-Known Member
#5
thanks KelvinHand for your kind help .......

I have one more problem hope you 'll also guide me .......

Could you make an AFL which can plot previous day closing price with a horizontal line on next day chart ...so we can figure out which stocks are up & down from previous day price ......

Now I have done this manually by plotting a Horizontal line bt problem is that I could not do this automatic way with help of any AFL .....







regards
TheMarketKid:)

Multiple Drag n Drop to Price Chart allowed, for each TimeFrame option and different Prices.
Style option:
1. styleDots (with line)
2. styleDots|styleNoline
3. styleBar
4. styleStairCase


Code:
ThisTF    = ParamList("TimeFrame", "Daily|Weekly|Monthly");
ThisPrice = ParamList("Price", "O|H|L|C", 3);
ThisColor = ParamColor("Color", colorYellow);
ThisStyle = ParamStyle("Style", styleNoLabel|styleDots|styleNoLine, maskAll);

switch (ThisTF)
{
  case "Monthly": 
        TF = inMonthly; 
        ThisTitle = "M_";
        break;
  case "Weekly":  
        TF = inWeekly; 
        ThisTitle = "W_";
        break;
  
   default:
       TF = inDaily; 
       ThisTitle = "D_";
       break;
}

ThisTitle = ThisTitle + ThisPrice;
ThisPlot = TimeFrameGetPrice(ThisPrice, TF); 
Plot(ThisPlot, ThisTitle,  ThisColor, ThisStyle);
 
#6
Multiple Drag n Drop to Price Chart allowed, for each TimeFrame option and different Prices.
Style option:
1. styleDots (with line)
2. styleDots|styleNoline
3. styleBar
4. styleStairCase


Code:
ThisTF    = ParamList("TimeFrame", "Daily|Weekly|Monthly");
ThisPrice = ParamList("Price", "O|H|L|C", 3);
ThisColor = ParamColor("Color", colorYellow);
ThisStyle = ParamStyle("Style", styleNoLabel|styleDots|styleNoLine, maskAll);

switch (ThisTF)
{
  case "Monthly": 
        TF = inMonthly; 
        ThisTitle = "M_";
        break;
  case "Weekly":  
        TF = inWeekly; 
        ThisTitle = "W_";
        break;
  
   default:
       TF = inDaily; 
       ThisTitle = "D_";
       break;
}

ThisTitle = ThisTitle + ThisPrice;
ThisPlot = TimeFrameGetPrice(ThisPrice, TF); 
Plot(ThisPlot, ThisTitle,  ThisColor, ThisStyle);

thanks for your help ......
It is a nice AFL but it could not plot Previous day Closing price on today chat ......I mean I want to put 18 oct 2012 closing price on 19 oct 2012 chart.....but in your AFL it plotting today closing price and its change Dynamically with every tick.......

could you plz modified this as per my requirement.......


Regards
TheMarkrtKid:)
 

KelvinHand

Well-Known Member
#7
thanks for your help ......
It is a nice AFL but it could not plot Previous day Closing price on today chat ......I mean I want to put 18 oct 2012 closing price on 19 oct 2012 chart.....but in your AFL it plotting today closing price and its change Dynamically with every tick.......

could you plz modified this as per my requirement.......


Regards
TheMarkrtKid:)
Very simple. change the above with below statement;
ThisPlot = TimeFrameGetPrice(ThisPrice, TF, -1);
 

ocil

Well-Known Member
#8
Hi KelvinHand

on below afl i want to use SAR1 as Stop loss in scan / backtest. Pls advice how to achieve that thanks for your help. :clap:

_SECTION_BEGIN("SAR");

acc = Param("Acceleration", 0.016, 0, 1, 0.001 );
accm = Param("Max. acceleration", 0.016, 0, 1, 0.001 );
SAR1 = SAR(acc,accm);
Buy = Cross(Open, SAR(acc,accm));
Sell = Cross(SAR(acc,accm), Open );
 

Similar threads