MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe) p2

cheap

Active Member
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Code:
TimeFrameSet( interval)  
RETURNS NOTHING  
FUNCTION  The TimeFrameSet replaces current price/volume arrays: open, high, low, close, volume, openint, avg with time-compressed bars of specified interval once you switched to a different time frame all calculations and built-in indicators operate on selected time frame. To get back to original interval call TimeFrameRestore() function. Before calling TimeFrameSet again in the same formula with different interval you have to restore original time frame first using TimeFrameRestore. 
[U][B][COLOR="Blue"]interval defines time frame interval in seconds[/COLOR][/B][/U]. [B][U]So 60 means 1-minute[/U][/B]. For the convenience the following interval constants are pre-defined: 

in1Minute = 60 
in5Minute = 5 * 60 
in15Minute = 15 * 60 
inHourly = 3600 
inDaily = 24 * 3600 
inWeekly = 5 * 24 * 3600 + 1 = 432001 
inMonthly = 25 * 24 * 3600 + 1 = 2160001 
inQuarterly (new in 5.20) 
inYearly (new in 5.20)
so 1 second time interval means "in1Minute/60"

its all there in the help file - so read the help file minutely again and again till u grasp the answer.
When you do type TimeframeSet(i * in___
it also shows 1second, you can see it in formula editor.
TimeframeSet(i * in1Second);


what would you use in case of second, like we use in minute database below
formula. Just /60 or in another way.
x= StrFormat("%02g-min", i);

x= StrFormat("%02g-min", i/60); or ?
 
Last edited:

cheap

Active Member
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)


used i* 1second
%2g-sec
but i do think it's not right.
there might be something, which is not right.
but of course there was only one way to change timeframe there.
TimeFrameSet(i* in1Second) that i did that..

second part
x= StrFormat("%02g-sec", i); // I ain't sure , maybe this part is wrong.

i heard words like tick and then minute database, i guess there's nothing like
second database (timeframe) , but why there's symbol of 1second in Database setting under File menu?

anyways
there might be something wrong with my setting. i tried to change database
setting to 1 second, same results... So i guess i need to change something in
Backtesting Setting, even though we ain't doing backtesting.

problem might be :
1. x= StrFormat("%02g-sec", i);
2. Database setting is 1second, //maybe this gonna be problem , or need to be corrected in 1 Tick.
3. Don't kknow ,Is there something needed to be changed in Backtesting Settings? Or maybe something else?
My mean totally is not working..


Anyways , i asked this additionally, back to the main problem.
 

cheap

Active Member
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Code:
_SECTION_BEGIN("Formula 41");
SetOption("NoDefaultColumns", True ); 

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 70 );
AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 150 );
AddColumn( Null, "bar", 1, colorDefault, colorDefault, 70 );



dt = DateTime(); 
 filter = 0; //outside the loop


for(i=1; i<=60; i++) { 

   TimeframeSet(i * in1Minute);
   
   up= C>O; 



   bar= Name() + "\t";
   bar= bar+ DateTimeToStr(LastValue(DateTime()))+ "\t"; 
 

   x= StrFormat("%02g-min", i);
   bar = bar+ WriteIf(up,  x, "\t");

  
        addRow(bar );
    
  TimeframeRestore();  
m1 = TimeFrameExpand(up,in1Minute);


for(i=1; i<=5; i++) {
 TimeframeSet(i * in1Minute);
up= C > O; //[if there is a bar, between 1 to 5 min.]
  TimeframeRestore();
}
m2= TimeFrameExpand(up, in1minute)

for(i=10; i<=15; i++) {
 TimeframeRestore();
up= C > O; //[if there is a bar, between 10 to 15 min.]
TimeframeRestore();
}
//m3 = TimeFrameExpand(up, in1minute) //or do we need to write in10minutes,('interval' must match the value used in TimeFrameCompress or TimeFrameSet)

m3 = TimeFrameExpand(up, in10minute);
Buy = m2 AND m3; // m2 + m3;

PlotShapes( shape, IIf( Buy, colorGreen, colorRed );
Buy = Exrem(Buy,Sell);
Sell =Exrem(sell,Buy);

}
_SECTION_END();
Same way, Code isn't working .


TimeFrameExpand ...
How do you use that in a loop? or it doesn't changed that..

i.e.
Code:
TimeFrameSet( in5Minute ); // switch to 5 minute frame 

/* MA now operates on 5 minute data, ma5_13 holds time-compressed 13 bar MA of 5min bars */ 

[B][COLOR="Red"]ma5_13 = MA( C, 13 ); 
[/COLOR][/B]
TimeFrameRestore(); // restore time frame to original

TimeFrameSet( inHourly ); // switch now to hourly 

mah_9 = EMA( C, 9 ); // 9 bar moving average from hourly data 

TimeFrameRestore(); // restore time frame to original 

Plot( Close, "Price", colorWhite, styleCandle ); 

// plot expanded average 

Plot( [COLOR="red"][B]TimeFrameExpand( ma5_13, in5Minute)[/B][/COLOR], "13 bar moving average from 5 min bars", colorRed ); 
Plot( TimeFrameExpand( mah_9, inHourly), "9 bar moving average from hourly bars", colorRed );
Variable inside TimeFrameSet and TimeFrameRestore is used in TimeFrameExpand. in example case it's ma

In our case
for(i=1; i<=5; i++) {
TimeframeSet(i * in1Minute);
up= C > O; //[if there is a bar, between 1 to 5 min.]
TimeframeRestore();
}
m2= TimeFrameExpand(up, in1minute)


1. In our case, it's up , Do you think it's rightly put it here.. Or do we need to get changed something in this.

2. If you don't use TimeFrameExpand , this timeframeexpand give us a
variable like m1,m2 , m3 , because of this , we can use it in Buy condition .
If we don't use TimeframeExpand function we can't Solve the problem.
 

cheap

Active Member
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Code:
_SECTION_BEGIN("Formula 41");
SetOption("NoDefaultColumns", True ); 

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 70 );
AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 150 );
AddColumn( Null, "bar", 1, colorDefault, colorDefault, 70 );



dt = DateTime(); 
 filter = 0; //outside the loop


for(i=1; i<=60; i++) { 

   TimeframeSet(i * in1Minute);
   
   up= C>O; 



   bar= Name() + "\t";
   bar= bar+ DateTimeToStr(LastValue(DateTime()))+ "\t"; 
 

   x= StrFormat("%02g-min", i);
   bar = bar+ WriteIf(up,  x, "\t");

  
        addRow(bar );
    
  TimeframeRestore();  
m1 = TimeFrameExpand(up,in1Minute);


for(i=1; i<=5; i++) {
 TimeframeSet(i * in1Minute);
up= C > O; //[if there is a bar, between 1 to 5 min.]
  TimeframeRestore();
}
m2= TimeFrameExpand(up, in1minute)

for(i=10; i<=15; i++) {
 TimeframeRestore();
up= C > O; //[if there is a bar, between 10 to 15 min.]
TimeframeRestore();
}
//m3 = TimeFrameExpand(up, in1minute) //or do we need to write in10minutes,('interval' must match the value used in TimeFrameCompress or TimeFrameSet)

m3 = TimeFrameExpand(up, in10minute);
Buy = m2 AND m3; // m2 + m3;

PlotShapes( shape, IIf( Buy, colorGreen, colorRed );
Buy = Exrem(Buy,Sell);
Sell =Exrem(sell,Buy);

}
_SECTION_END();
Same way, Code isn't working .


TimeFrameExpand ...
How do you use that in a loop? or it doesn't changed that..

i.e.
Code:
TimeFrameSet( in5Minute ); // switch to 5 minute frame 

/* MA now operates on 5 minute data, ma5_13 holds time-compressed 13 bar MA of 5min bars */ 

[B][COLOR="Red"]ma5_13 = MA( C, 13 ); 
[/COLOR][/B]
TimeFrameRestore(); // restore time frame to original

TimeFrameSet( inHourly ); // switch now to hourly 

mah_9 = EMA( C, 9 ); // 9 bar moving average from hourly data 

TimeFrameRestore(); // restore time frame to original 

Plot( Close, "Price", colorWhite, styleCandle ); 

// plot expanded average 

Plot( [COLOR="red"][B]TimeFrameExpand( ma5_13, in5Minute)[/B][/COLOR], "13 bar moving average from 5 min bars", colorRed ); 
Plot( TimeFrameExpand( mah_9, inHourly), "9 bar moving average from hourly bars", colorRed );
Variable inside TimeFrameSet and TimeFrameRestore is used in TimeFrameExpand. in example case it's ma

In our case
for(i=1; i<=5; i++) {
TimeframeSet(i * in1Minute);
up= C > O; //[if there is a bar, between 1 to 5 min.]
TimeframeRestore();
}
m2= TimeFrameExpand(up, in1minute)


1. In our case, it's up , Do you think it's rightly put it here.. Or do we need to get changed something in this.

2. If you don't use TimeFrameExpand , this timeframeexpand give us a
variable like m1,m2 , m3 , because of this , we can use it in Buy condition .
If we don't use TimeframeExpand function we can't Solve the problem.
Right now is Big confusion is about Timeframeexpand in looping?//we have one example of looping,but that was looping of bar
and
in BUY CONDITION HOW WOULD YOU WRITE A CONDITION WHERE IT TAKES TWO SEPARATE CONDITION , IF IT FULFILL BOTH TWO GIVES AN OUTPUT.
// this is also a big hurdle, actually right now hurdle is making right buy condition

These two confusion still there, I tried to find lot of afl to get idea, but this is bit different. So now get stuck around it.
Making exploration beautiful is fine. but if we can't make something out of it not fine.
 

cheap

Active Member
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

there might be something, which is not right.
but of course there was only one way to change timeframe there.
TimeFrameSet(i* in1Second) that i did that..

second part
x= StrFormat("%02g-sec", i); // I ain't sure , maybe this part is wrong.

i heard words like tick and then minute database, i guess there's nothing like
second database (timeframe) , but why there's symbol of 1second in Database setting under File menu?

anyways
there might be something wrong with my setting. i tried to change database
setting to 1 second, same results... So i guess i need to change something in
Backtesting Setting, even though we ain't doing backtesting.

problem might be :
1. x= StrFormat("%02g-sec", i);
2. Database setting is 1second, //maybe this gonna be problem , or need to be corrected in 1 Tick.
3. Don't kknow ,Is there something needed to be changed in Backtesting Settings? Or maybe something else?
My mean totally is not working..


Anyways , i asked this additionally, back to the main problem.


Just changed Backtesting setting Tick.
 

cheap

Active Member
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Let's talk about this problem. we wanna make arrow and little system.
Is this format right? ofcourse code isn't working .
PATTERN BETWEEN 10min. to 15min. AND find bar
PATTERN BETWEEN 1min. to 5min. putting arrow on 1 min. timeframe.

for plotting arrow, we need buy condition it can't be possible i guess. I made these two as buy condition
In case it's forming bar, only for checking on historical data.take it as repainting.

I mean, what variable do we use that help us to put arrow on chart, Is it possible to make buy sell arrow from exploration?

we have to use two loops and we have to use AND statement for this.

for(i=1; i<=5; i++) {
up= C > O; //[if there is a bar, between 1 to 5 min.]
}

for(i=10; i<=15; i++) {
up= C > O; //[if there is a bar, between 10 to 15 min.]
}

now what variable do we use that satisfy this condition and add it?
AND operator gonna be used?
or we do it like this ?

for(i=1; i<=5; i++) {
up= C > O; //[if there is a bar, between 1 to 5 min.]
}
m2= TimeFrameExpand(up, in1minute)

for(i=10; i<=15; i++) {
up= C > O; //[if there is a bar, between 10 to 15 min.]
}
//m3 = TimeFrameExpand(up, in1minute) //or do we need to write in10minutes,('interval' must match the value used in TimeFrameCompress or TimeFrameSet)

m3 = TimeFrameExpand(up, in10minute);
Buy = m2 AND m3; // m2 + m3;
//first we need to make right buy condition then plotting arrow on 1minute base timeframe.
1. IS THIS CONDITION IS RIGHT WAY OF CODING?
2. what do we use TO PLOT ARROW ON BASETIMEFRAME.




LET'S BACK TO THE MAIN PROBLEM.
SECOND DATABASE PROBLEM SOLVED WHEN YOU DO USE RIGHT BACKTESTING SETTING, that has to be 1 tick or 1 second .. not like 15 second or something, if you make it that you will get wrong output.
you only see 1 sec and tick in Backtesting SEttings when you have Database setting to tick or sec. .. tick.
so always make it 1 second or 1 tick on backtest settings. .that's it ..



 
Last edited:

cheap

Active Member
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

PATTERN BETWEEN 10min. to 15min. AND find bar
PATTERN BETWEEN 1min. to 5min. putting arrow on 1 min. timeframe.


Function we do use:
TimeframeSet();
TimeFrameRestore();
TimeFrameExpand();// important
Plot();
PlotShapes();
TimeFrameGetPrice(); // ?? DO // WE NEED TO EXTRACT VALUES FROM LOOP BY THIS SINCE USING TIMERANGE(TIMEFRAME LOOP)



Any idea? I guess we do need these functions?


ANONYMOUS READER AND MEMBERS.. TRY TO DO IT.. DONT SAY LIKE I CAN'T DO IT.. I'M ALSO TRYING .. WORST CASE IT GONNA BE WRONG..
 
Last edited:

cheap

Active Member
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

PATTERN BETWEEN 10min. to 15min. AND find bar
PATTERN BETWEEN 1min. to 5min. putting arrow on 1 min. timeframe.


Function we do use:
TimeframeSet();
TimeFrameRestore();
TimeFrameExpand();// important
Plot();
PlotShapes();
TimeFrameGetPrice(); // ?? DO // WE NEED TO EXTRACT VALUES FROM LOOP BY THIS SINCE USING TIMERANGE(TIMEFRAME LOOP)



Any idea? I guess we do need these functions?


ANONYMOUS READER AND MEMBERS.. TRY TO DO IT.. DONT SAY LIKE I CAN'T DO IT.. I'M ALSO TRYING .. WORST CASE IT GONNA BE WRONG..
Code:
_SECTION_BEGIN("try");
for(i=1; i<=5; i++) {
TimeframeSet(i * in1Minute);
up15= C > O; 
}
TimeframeRestore();

for(i=10; i<=15; i++) {
TimeframeSet(i * (2*in5Minute));
up1015= C > O;
}
TimeframeRestore();

expandmode = expandPoint;
up15= TimeFrameExpand(up15, in1minute, expandmode);
up1015 = TimeFrameExpand(up1015, (2*in5Minute), expandmode);

Plot( C, "Price", colorDefault, styleCandle ); // Just to show on pane
PlotShapes( IIF( up15 AND up1015, shapeUpArrow , shapeNone ), colorAqua ); 

_SECTION_END();
Kindly give your views ..

Using expandPoint is right in loop?
If you're using Higher to lower timeframe..
You use only expandFirst ?

KINDLY ON THREAD DONT USE WORDS LIKE "I'M DONE WITH IT" , YOU CAN'T BE DONE HERE, YOU ARE ALWAYS WELCOMED, KINDLY DON'T DISHEARTEN
YOU ARE A BEAUTIFUL PERSON , WE NEED YOU, WHY YOU SAY..I'M DONE WITH THREAD
YOU NEVER BE DONE LIKE THAT, EVEN IF YOU SAY SO ..
IT SHOULDN'T BE LIKE MAN WITH WORDS.. SAID IT AND STICK IT,.... NO! JUST NO! BIG NO! NEVER ! there's ONLY LOVE NO HATE
HERE ATLEAST FOR FEW FOLKS, YOU CAN'T BE DONE, CAN'T SAY ABOUT OTHERS.
 
Last edited:

cheap

Active Member
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Hi,
In this thread , we will continue to discuss..
1. How to extract values From exploration. or we can do it without doing exploration ?
2. How to make signal out of the values , with or without doing exploration ..

and Rerequired function to do it.
When to use which function?

Timeframeexpand align High timeframe data to lower timeframe data..

and what to do when you have more than 1 values out in range..
i.e. If i say Bar between 1 min. to 5 min.
if there is value more than one like 1 min. and 5 min. both have bar, How does effect signal?

For solving it,
I started with simple examples.. that example still didn't get solved..
 
Last edited:

Similar threads