AFL code for Candle

MSN1979

Well-Known Member
#1
Hi

I would like to store candle data open high low close in 5 min chart for all the candles made from 9:15 to 3:30, If possible in a array or some type of variable. Can this be done?
 

KAL.YUG

Well-Known Member
#2
If I understood right you mean to say you want to convert 1 Min data to 5 Min data right?
In that case use this :

Filter=1;
AddColumn(O,"Open");
AddColumn(H,"High");
AddColumn(L,"Low");
AddColumn(C,"Close");
AddColumn(V,"Volume",1.0);
AddColumn(OI,"Open Interest",1.0);

... in analysis > explore
and while in settings (backtester settings ) set periodicity to 5 min.
Next, File > Export > HTML/CSV and save as CSV or as text (- if you prefer)


K
 
Last edited:

MSN1979

Well-Known Member
#3
If I understood right you mean to say you want to convert 1 Min data to 5 Min data right?
In that case use this :

Filter=1;
AddColumn(O,"Open");
AddColumn(H,"High");
AddColumn(L,"Low");
AddColumn(C,"Close");
AddColumn(V,"Volume",1.0);
AddColumn(OI,"Open Interest",1.0);

... in analysis > explore
and while in settings (backtester settings ) set periodicity to 5 min.
Next, File > Export > HTML/CSV and save as CSV or as text (- if you prefer)


K
No Bro

On 5 min chart we have
What I mean is at 9:15 we have first candle. Second candle starts at 9:20 and ends at 9:25. So I would simply like to store data for both 5 min candles and compare its OHLC values.
 

MSN1979

Well-Known Member
#5
You
- want to store where, in which mode/file format
- want 5 min data stored in real time or eod wil also do.
I have made some progress so far, this is what I have learnt.

I can use Ref function to play with OHLC.

So my play area made some progress but this is what I have

x=Low < Ref( Low , -1 );
PlotShapes(IIf(x,shapeSmallCircle,shapeNone),colorRed,0,L,-12);

Can you tell me if x is a array or holding a numeric or Boolean here?

Problem now is if I print x it always show 0? Why? shoudnt it print the values changing as per logic.

It could be I need a for loop to print different values of x but when I use for loop it says you are using an array.

x=Low < Ref( Low , -1 );
for (i=0; i<x; i++)
{
printf("X %g", x);
}
PlotShapes(IIf(x,shapeSmallCircle,shapeNone),colorRed,0,L,-12);

1543036217803.png
 

MSN1979

Well-Known Member
#9
Hello Sir, we can check value of x in exploration :)
Code:
Filter = 1;
AddColumn(x,"x");

1543039547606.png


Hi

Looks like something is wrong. Doesn't look correct does it?