general question on timeframeset + help on loop

#1
Hi,

There is cool function called FLIP that I believe could make the code cleaner, save loop time & lines of programming.

I would like to remove the following loop from a code. Can someone suggest how to use FLIP? I am not very successful at using it... (If used IIF() statements on CondR and CondF etcetc but it didnt work properly...)


MAD = HMA(Pd,perd);
MAL = LinearReg(Pl,perd);
CondR = ROC(MAD,1)>0 AND ROC(MAL,1)>0;
CondF = ROC(MAD,1)<0 AND ROC(MAL,1)<0;
R[0] = C[0]>(H[0]+L[0])/2;

//en exploration: 0 ou 1 si uptrend ou downtrend
//loop depuis le debut jusqu'a la derniere barre
for(i=1;i<BarCount;i++)
{
if( CondR )
{
R = 1;
}
else
{
if( CondF )
{
R = 0;
}
else
{
R = R[i-1];
}
}
}
return R;
}



Also, a general question on timeframeset to check if I have understood well.

Say I look at the 5mins chart.
I use timeframeset to calculate my indicators on a 15mins and 30mins bars and display them on the 5mins. Am I correct assuming these indicators will be updated every 5 mins? (what Don Mak calls "skipped convolution" in his books)

(by the way: the indicators I look at seem to be calculated in real time, is there a function to calculate them only when the bar is finished?)

Thanks
Alex
 

mastermind007

Well-Known Member
#3

Similar threads