how to edit given afl for multiple time frame

#1
i took these lines of code from http://www.amibroker.com/docs/MTFIndicators.html

Count = 0;
result = 0;

for( i = 5; i <= 360; i = i+5 )
{
TimeFrameSet( i * in1Minute );
m = RSI();
TimeFrameRestore();

m = TimeFrameExpand( m, i * in1Minute );

result = result + IIf( m > 70, 1, IIf( m < 30, -1, 0 ) );
Count++;
}

now i have two conditions A and B.
A=(A1 OR A2) //A is some buy condition with multi indicators
B=(B1 OR B2).// B is some sell condition with multi indicators
what i want is -
result = result + iff( m = A, 1, iff( m = B, -1, 0));
as i am new to amibroker, so please any one help me editing this code according my requirement.
thanks in advance.
 

mastermind007

Well-Known Member
#2
i took these lines of code from http://www.amibroker.com/docs/MTFIndicators.html

Count = 0;
result = 0;

for( i = 5; i <= 360; i = i+5 )
{
TimeFrameSet( i * in1Minute );
m = RSI();
TimeFrameRestore();

m = TimeFrameExpand( m, i * in1Minute );

result = result + IIf( m > 70, 1, IIf( m < 30, -1, 0 ) );
Count++;
}

now i have two conditions A and B.
A=(A1 OR A2) //A is some buy condition with multi indicators
B=(B1 OR B2).// B is some sell condition with multi indicators
what i want is -
result = result + iff( m = A, 1, iff( m = B, -1, 0));
as i am new to amibroker, so please any one help me editing this code according my requirement.
thanks in advance.
I hope you did not miss the warning on top?

THIS ARTICLE IS OUTDATED. IT IS 9 YEARS OLD. SINCE THEN AMIBROKER EVOLVED A LOT. CURRENTLY AMIBROKER SUPPORTS WAY BETTER TOOLS SUCH AS STATIC ARRAY VARIABLES THAT ALLOW DOING MTF INDICATORS WITHOUT USING ADDTOCOMPOSITE/FOREIGN FUNCTIONS.
 

mastermind007

Well-Known Member
#4
The concept surely looks attractive.
What are the evolved options available plz.

Thanks
Rajesh
IMHO, the MTF approach mentioned in amibroker site tends to merge specific back to general and I am unable to see any advantage in that. Timeframes are not democratic....

Shortly before I saw your thread, I had started a new thread aimed at exploring the timeframe optimising. Reading thru the site you posted, I am essentially working on the idea they've rejected at the start itself because they do not want to curve fit again and again

Their approach is to detect the repetitiveness of a signal for a given candle across all the chosen time-frames. I don't care so much about the number of generated trades signals but on the quality of the trades and the resulting profit of the trade. Therefore, you could say that I am viewing the problem from its tail. I do expect to have to run the curve-fitting routines at least once every month.
 
Last edited:

Similar threads