OHLC Afl Code needed

#1
Dear experts n programmers ..

i need AFL code to plot line for current day 1st one hourcandle HLC ..

kindly provide me code in urgent

thanks in advance
 
#2
_SECTION_BEGIN("Price");
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() );
_SECTION_END();

_SECTION_BEGIN("One Hour High-Low");

OST=091500; //Observation Start Time
OET=101500; //Observation End Time
MET=153000; //Market End Time

Currtime =TimeNum(); //get current time


ob_end = Cross(TimeNum(),OET); //detect the observation end time
ob_st = Cross(TimeNum(),OST); //detect the observation start time


Highest_since = HighestSince(ob_st,H,1); //capture the 1 hour high
Lowest_since = LowestSince(ob_st,L,1); //capture the 1 hour low

ORBH = ValueWhen(ob_end ,Highest_since,1); //
ORBL = ValueWhen(ob_end ,Lowest_since,1);

Plot(ORBH,"",colorGreen,styleDots);
Plot(ORBL,"",colorBlue,styleDots);


_SECTION_END();
 
#3
_SECTION_BEGIN("Price");
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() );
_SECTION_END();

_SECTION_BEGIN("One Hour High-Low");

OST=091500; //Observation Start Time
OET=101500; //Observation End Time
MET=153000; //Market End Time

Currtime =TimeNum(); //get current time


ob_end = Cross(TimeNum(),OET); //detect the observation end time
ob_st = Cross(TimeNum(),OST); //detect the observation start time


Highest_since = HighestSince(ob_st,H,1); //capture the 1 hour high
Lowest_since = LowestSince(ob_st,L,1); //capture the 1 hour low

ORBH = ValueWhen(ob_end ,Highest_since,1); //
ORBL = ValueWhen(ob_end ,Lowest_since,1);

Plot(ORBH,"",colorGreen,styleDots);
Plot(ORBL,"",colorBlue,styleDots);


_SECTION_END();

Dear sir ... thnx for ur help ..

but this code i found in net but not working .. pls check it once ..

thanks ,,,
 
#4
_SECTION_BEGIN("Price");
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() );
_SECTION_END();

_SECTION_BEGIN("One Hour High-Low");

OST=091500; //Observation Start Time
OET=101500; //Observation End Time
MET=153000; //Market End Time

Currtime =TimeNum(); //get current time


ob_end = Cross(TimeNum(),OET); //detect the observation end time
ob_st = Cross(TimeNum(),OST); //detect the observation start time


Highest_since = HighestSince(ob_st,H,1); //capture the 1 hour high
Lowest_since = LowestSince(ob_st,L,1); //capture the 1 hour low

ORBH = ValueWhen(ob_end ,Highest_since,1); //
ORBL = ValueWhen(ob_end ,Lowest_since,1);

Plot(ORBH,"",colorGreen,styleDots);
Plot(ORBL,"",colorBlue,styleDots);


_SECTION_END();
Thanks for ur help sir ...

but thiscode is not working ...

pls check once ...
 
#5
PLZ help to ADD/AMEND THE BELOW CODE TO SHOW THE CORRESPONDING TIME TO THE LAST 5 TRADES WHEN THEy HAPPENED?
// Implemented by Rajandran R
// Website : www.marketcalls.in3
// Date : 24th Oct 2014
// Ideation Credits to : Fxshrat

SECTIONBEGIN("Last Five Trades Dashboard");

//set initial values

SetOption( "InitialEquity", 100000);
SetOption("FuturesMode" ,false);
SetOption("MinShares",1);
SetOption("CommissionMode",2);
SetOption("CommissionAmount",0);
SetOption("AccountMargin",100);
SetOption("RefreshWhenCompleted",True);
SetTradeDelays(0,0,0,0);
SetPositionSize(1,spsShares);

//set trading rules

Buy = Cross( MACD(), Signal() );
Sell = Cross( Signal(), MACD() );

Short = Sell;
Cover = Buy;

BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);

//plot buy or sell arrows

PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

// Calculate Equity Curve

eq = Equity( 1, 0 );

//////////////////////////////////////////////////
// Calculate the Last Five Trades Profit/Losses //
//////////////////////////////////////////////////

tradesback = 5;
Signum = Cum( Buy ) + Cum( Short );
Signumstart1 = LastValue( SigNum ) - ( tradesback - 1 );
Signumstart2 = LastValue( SigNum ) - ( tradesback - 2 );
Signumstart3 = LastValue( SigNum ) - ( tradesback - 3 );
Signumstart4 = LastValue( SigNum ) - ( tradesback - 4 );
Signumstart5 = LastValue( SigNum ) - ( tradesback - 5 );

bi = BarIndex();
bistart = ValueWhen( signum == signumstart1, bi );
bicond = bi >= bistart AND bi <= LastValue( bi );

SellPL = IIf( Sell AND bicond, C-buyprice, 0 );
CovPL = IIf( Cover AND bicond, ShortPrice - C,0 );

cumPL = SellPL + CovPL;

//Plot (SellPL,"Sell",colorGreen,styleHistogram,maskhistogram);
///Plot (CovPL,"Cover", colorRed,styleHistogram,maskhistogram);

lsince = lowestSince(Sell OR Cover, cumPL, 0);
hsince = highestSince(Sell OR cover, CumPL, 0);

vs= IIf(lsince==0,hsince,lsince);

PL1 = ValueWhen( signum == signumstart1 , vs,1 );
PL2 = ValueWhen( signum == signumstart2 , vs,1 );
PL3 = ValueWhen( signum == signumstart3 , vs,1 );
PL4 = ValueWhen( signum == signumstart4 , vs,1 );
PL5 = ValueWhen( signum == signumstart5, vs ,1 );

//////////////////////////////////////////////////
// Plot the Last Five Trades Profit/Losses //
//////////////////////////////////////////////////

Title = EncodeColor(colorWhite)+ "Backtest Results from www.marketcalls.in3" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +

" - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+

"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+ EncodeColor(colorYellow)+ "\n\n\nLast 5 Trade Results\n" +
"\nTrade1= " + PL1
+"\n"+ "Trade2= " + PL2
+"\n"+ "Trade3= " + PL3
+"\n"+ "Trade4= " + PL4
+"\n"+ "Trade5= " + PL5;

////////////////////////////////////////////////////////////////

SECTIONEND();

// Plot Candlesticks

SECTIONBEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
SECTIONEND();
 
#6
High Low Index

Dear Members,

I need a afl which can calculate the below formula. This is market breath indicator for long

Record High Percent = {New 52 week Highs / (New 52 week high Highs + New 52 week Lows)} x 100

High-Low Index = 10-day SMA of Record High Percent

Which can plot a line in amibroker
 

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?