Need your help in multitimeframe

#11

amibroker preference setting: Start of interval
Hello Trash,
what is wrong in this?
regards

we want arrow when candle is finished. like In the picture
 

trash

Well-Known Member
#13
First of all the condition is Iif( bar30 AND bar60, ...
So the AFL is made for TF's equal or lower then 30 minute.

Secondly if start time of bar is 12:00:00 and it's hourly TF then end time is 12:59:59 and if it is green bar then one condition (bar60) is true.

Now, in order to make entire condition being true 30 minute bar showing start time 12:30 must be true also since it is bar from 12:30:00 to 12:59:59 so same end time as hourly bar.

That's exactly what is shown in your first 30min/60-min chart picture!

I'm finished in this thread. It 's pointless wasting more time.
Go to AB support if your don't understand.
 
#14
First of all the condition is Iif( bar30 AND bar60, ...
So the AFL is made for TF's equal or lower then 30 minute.

Secondly if start time of bar is 12:00:00 and it's hourly TF then end time is 12:59:59 and if it is green bar then one condition (bar60) is true.

Now, in order to make entire condition being true 30 minute bar showing start time 12:30 must be true also since it is bar from 12:30:00 to 12:59:59 so same end time as hourly bar.

That's exactly what is shown in your first 30min/60-min chart picture!

I'm finished in this thread. It 's pointless wasting more time.
Go to AB support if your don't understand.
HI Trash,
First of all the condition is Iif( bar30 AND bar60, ...
So the AFL is made for TF's equal or lower then 30 minute.


I don't know why is it for lower than 30 minute, only needed two timeframe.
Do i need to type
IIF( bar30 ==1 AND bar60 ==1) ?? For right condition?


Now, in order to make entire condition being true 30 minute bar showing start time 12:30 must be true also since it is bar from 12:30:00 to 12:59:59 so same end time as hourly bar.

That's exactly what is shown in your first 30min/60-min chart picture!


Yes, this all thing i posted in case 1 and case 2 , i made other picture because i don't want that.

What do i need to do make condition right

Only need arrow after candlestick complete.
not case 1 and case 2 ,because it's not right .

regards
 
#15
First of all the condition is Iif( bar30 AND bar60, ...
So the AFL is made for TF's equal or lower then 30 minute.

Secondly if start time of bar is 12:00:00 and it's hourly TF then end time is 12:59:59 and if it is green bar then one condition (bar60) is true.

Now, in order to make entire condition being true 30 minute bar showing start time 12:30 must be true also since it is bar from 12:30:00 to 12:59:59 so same end time as hourly bar.

That's exactly what is shown in your first 30min/60-min chart picture!

I'm finished in this thread. It 's pointless wasting more time.
Go to AB support if your don't understand.

PlotShapes( IIF( Bar30 AND Bar60, shapeUpArrow , shapeNone ), colorAqua );

to

PlotShapes( IIF( Bar30==1 AND Bar60==1, shapeUpArrow , shapeNone ), colorAqua );


Is this the correct way?
 

vijkris

Learner and Follower
#16
just giving a sample code. pls try. It may suit your requirement. put your chart to 30 tf to see the arrows.

Code:
SetChartBkColor(colorBlack);
SetChartOptions( 2,chartShowArrows+ chartShowDates |   chartWrapTitle );
Layer = Param("Layer", 0, -5, 5, 1) ;
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} " + EncodeColor( colorGreen ) + " Open %g," + EncodeColor( colorBlue ) + " Hi %g,  " + EncodeColor( colorRed ) + " Lo %g,  " + EncodeColor( colorBlue ) + " Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

HiVolume = IIf(V > (2 * MA(V,10)), True, False); 
PlotShapes(shapeSmallCircle * HiVolume, IIf(C > O, colorRed, colorWhite), 0, (O+C)/2, 0);
ToolTip = "Open = " + O + "\nHigh = " + H + "\nLow = " + L + "\nClose = " + C ;
Plot( C, "Close",  colorTeal, styleNoTitle | styleCandle,0,0,0,Layer ); 

TimeFrameSet(inHourly);
green = C>O;
prevgreen = Ref(green,-1)==1;
TimeFrameRestore();
greenexp = TimeFrameExpand(prevgreen,inHourly);

PlotShapes(IIf(greenexp,shapeUpArrow,shapeNone),colorGreen,0,L,-35);
 
#17
just giving a sample code. pls try. It may suit your requirement. put your chart to 30 tf to see the arrows.

Code:
SetChartBkColor(colorBlack);
SetChartOptions( 2,chartShowArrows+ chartShowDates |   chartWrapTitle );
Layer = Param("Layer", 0, -5, 5, 1) ;
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} " + EncodeColor( colorGreen ) + " Open %g," + EncodeColor( colorBlue ) + " Hi %g,  " + EncodeColor( colorRed ) + " Lo %g,  " + EncodeColor( colorBlue ) + " Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

HiVolume = IIf(V > (2 * MA(V,10)), True, False); 
PlotShapes(shapeSmallCircle * HiVolume, IIf(C > O, colorRed, colorWhite), 0, (O+C)/2, 0);
ToolTip = "Open = " + O + "\nHigh = " + H + "\nLow = " + L + "\nClose = " + C ;
Plot( C, "Close",  colorTeal, styleNoTitle | styleCandle,0,0,0,Layer ); 

TimeFrameSet(inHourly);
green = C>O;
prevgreen = Ref(green,-1)==1;
TimeFrameRestore();
greenexp = TimeFrameExpand(prevgreen,inHourly);

PlotShapes(IIf(greenexp,shapeUpArrow,shapeNone),colorGreen,0,L,-35);
Hi vijkris,
use this code and use amibroker and post a chart here
with two side pan left pan 30 minute and right pan 60 minute.
Put this chart and I will edit that pic and post you here

Please post chart here with this code wtih two panes
by this, i will tell better and you can see it with your database.
regards
 

trash

Well-Known Member
#18
HI Trash,
First of all the condition is Iif( bar30 AND bar60, ...
So the AFL is made for TF's equal or lower then 30 minute.


I don't know why is it for lower than 30 minute, only needed two timeframe.
Do i need to type
IIF( bar30 ==1 AND bar60 ==1) ?? For right condition?


Now, in order to make entire condition being true 30 minute bar showing start time 12:30 must be true also since it is bar from 12:30:00 to 12:59:59 so same end time as hourly bar.

That's exactly what is shown in your first 30min/60-min chart picture!


Yes, this all thing i posted in case 1 and case 2 , i made other picture because i don't want that.

What do i need to do make condition right

Only need arrow after candlestick complete.
not case 1 and case 2 ,because it's not right .

regards
My code of previous page has been a response to cheap but not to you. You posted conclusions based on that code and those conclusion were wrong.

And I did not write "lower than 30 minute" but wrote EQUAL OR lower than 30 minute because it depends on 30 minute and 60 minute MTF condition as per post by cheap. So read carefully.

What you want is totally different to my response to cheap.

What you want is this.

Code:
/// applied on 30 minute

TimeframeSet( inHourly );
Bar60 = C > O;
TimeframeRestore(); 

expandmode = expandPoint;
Bar60 = Ref( TimeFrameExpand( Bar60, inHourly, expandmode ), -1);
Bar30 = C>O;
 
Plot( C, "", colorDefault, styleCandle ); // Just to show on pane
PlotShapes( IIF( Bar30 AND Bar60, shapeUpArrow , shapeNone ), colorAqua ); 

_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} - {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%), Vol %g {{VALUES}}",
                           O, H, L, C, SelectedValue( ROC( C, 1 ) ), V ) );

Code:
/// applied on 60 minute

Plot( C, "", colorDefault, styleCandle ); // Just to show on pane
PlotShapes( IIF( C>O, shapeUpArrow , shapeNone ), colorAqua ); 

_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} - {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%), Vol %g {{VALUES}}",
                           O, H, L, C, SelectedValue( ROC( C, 1 ) ), V ) );

Code:
bar30 ==1 AND bar60 ==1
means the same thing as

Code:
bar30 AND bar60
 
Last edited:
#19
My code of previous page has been a response to cheap but not to you. You posted conclusions based on that code and those conclusion were wrong.

And I did not write "lower than 30 minute" but wrote EQUAL OR lower than 30 minute because it depends on 30 minute and 60 minute MTF condition as per post by cheap. So read carefully.

What you want is totally different to my response to cheap.

What you want is this.

Code:
/// applied on 30 minute

TimeframeSet( inHourly );
Bar60 = C > O;
TimeframeRestore(); 

expandmode = expandPoint;
Bar60 = Ref( TimeFrameExpand( Bar60, inHourly, expandmode ), -1);
Bar30 = C>O;
 
Plot( C, "", colorDefault, styleCandle ); // Just to show on pane
PlotShapes( IIF( Bar30 AND Bar60, shapeUpArrow , shapeNone ), colorAqua ); 

_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} - {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%), Vol %g {{VALUES}}",
                           O, H, L, C, SelectedValue( ROC( C, 1 ) ), V ) );

Code:
/// applied on 60 minute

Plot( C, "", colorDefault, styleCandle ); // Just to show on pane
PlotShapes( IIF( C>O, shapeUpArrow , shapeNone ), colorAqua ); 

_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} - {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%), Vol %g {{VALUES}}",
                           O, H, L, C, SelectedValue( ROC( C, 1 ) ), V ) );

Code:
bar30 ==1 AND bar60 ==1
means the same thing as

Code:
bar30 AND bar60
Hi,
it's showing arrow only on bullish candles on 30 minute timeframe, it's not showing it on bearish
I explained in picture.





it's working for bull candle on 30 minute. when 60 minute bull candle completed, it shouldn't depend on what was on 30 minute bull or bear candle.
In short, it is only working for bull candle , i think you getting , in what sense i want to say. Thank you

2. Can i use more than 2 timeframe with expandpoint? or do i need to use expandFirst?
Do i need to use TimeFrameGetPrice function in it.

regards
 
Last edited:

trash

Well-Known Member
#20
YOUR picture was showing three bullish 30min candles. And you posted Bar30 AND Bar60 yourself the whole time!

If you want independent 30min then remove "Bar30 =" and "Bar30 AND".
Is that really that difficult?


2. Can i use more than 2 timeframe
What two timeframes? The first code is dependent on hourly TF so far.

If you want to plot the code for 30 minute and 60 minute chart then make condition based on Interval().

Code:
/// @link http://www.traderji.com/software/101822-need-your-help-multitimeframe-2.html#post1157240

Plot( C, "", colorDefault, styleCandle ); // Just to show on pane

if( Interval() < 3600 ) {
    TimeframeSet( inHourly );
    Bar60 = C > O;
    TimeframeRestore(); 

    expandmode = expandPoint;
    Bar60 = Ref( TimeFrameExpand( Bar60, inHourly, expandmode ), -1);     
} else
    Bar60 = C>O;

PlotShapes( IIF( Bar60, shapeUpArrow , shapeNone ), colorAqua );

_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} - {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%), Vol %g {{VALUES}}",
                           O, H, L, C, SelectedValue( ROC( C, 1 ) ), V ) );
As for difference between expandpoint and expandfirst read here
http://amibrokerforum.proboards.com/thread/155/time-frame-functions
 
Last edited:

Similar threads