Problem with Stochastic TimeFrameSet

I hope you excuse my English level.
I have done an exploration when the stochastic of 89 in monthly is less than 90 and the capitalization, in daily, is greater than 1,000,000. In the Analysis settings periodicity I have selected in Daily and in Range "1 recent bar (s)".
The result that I obtain is fulfilled but in the bar of the previous month, not in the current month (I look at the graph in monthly) and I want it to be fulfilled in the current month.
I searched the forum and the Amibroker manual but I did not find an answer, my language is not English and I have difficulty interpreting what I read . Thank you.

// Stochastic(89)
TimeFrameSet( inMonthly); // switch to Monthly
periods = Param( "Periods", 89, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );

myStochK89 = StochK(89,Ksmooth);
StochDarkGrey = StochD(89);
StochBlack = StochK(89);
TimeFrameRestore(); // restore time frame to original 
	
// Capitalization
TimeFrameSet( inDaily ); // switch to Daily
Cap = Ref(V*C, -1); 
TimeFrameRestore(); // restore time frame to original

   
    SetSortColumns(-4); 
AddTextColumn(FullName(),"Name");
AddColumn( myStochK89, "Stoch(89)" );
AddColumn(Cap,"Cap",1.0);

Filter = TimeFrameExpand(myStochK89, inMonthly) < 90 AND TimeFrameExpand(Cap,inDaily) > 1000000;

image

Hi @mikelamezaga,

No need to apologize for your English - your English is very good!

Place 'Params' outside of 'TimeFrameSet'.

If your Analysis Settings is set to Daily then you don't need this:

With the below you need 'TimeFrameExpand(myStochK89, inMonthly)'

Let us know how you go.

3 Likes

Thank you very much for your answer TrendSurfer.
Google Translate is wonderful for when a person needs help in English, my English level is not as good as I would like it to be.
I have followed your instructions but the result is the same. The problem is that in the Analysis window, the stochastic (89) yields a result of 94.28 (in Kratos for example) which corresponds to the current month of June and it is greater than 90. However, if I look at the bar May, then it is less than 90. It is possible that I have a configuration problem with my Amibroker but I do not know.

@mikelamezaga,

Please post up your current code for review.

Excuse me if I'm not doing your instructions right. Thanks for your time.

// Stochastic(89)
periods = Param( "Periods", 89, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );

TimeFrameSet( inMonthly); // switch to Monthly
myStochK89 = StochK(89,Ksmooth);
TimeFrameRestore(); // restore time frame to original 
	
	
// Capitalization
Cap = Ref(V*C, -1); 

   
    SetSortColumns(-4); 
AddTextColumn(FullName(),"Name");
AddColumn( myStochK89, "Stoch(89)" );
AddColumn(Cap,"Cap",1.0);

Filter = TimeFrameExpand(myStochK89, inMonthly) < 90 AND TimeFrameExpand(Cap,inDaily) > 1000000;
1 Like

Needs to be:

AddColumn(TimeFrameExpand(myStochK89, inMonthly), "Stoch(89)" );

I have followed your instructions and now you are already selected the stocks which have the Stochastic (89) less than 90 but are those that met that condition in the month of May to closed bar and now we are in June.

It is possible that I have an error in the concept of time and charts in Amibroker. Actually I am looking for is a filter of those stocks that in this month of June and looking today in monthly chart meet the condition of having the stochastic (89) below 90.

@mikelamezaga,

What data provider are you using?

Does your Monthly charts show current progressive bars or do they only show to the end of May?

can you provide the QuickAFL setting from the Analysis window ?
Try using all the bars also.

It sometimes happens, as i have seen in Wilders Smoothing when i have a large number of base interval bars required ( say testing a Daily over 5m etc), it takes alot of bars as that is the nature of the formula.
SMA 10 for eg.would just need those many bars, but Wilders needs far more than 10 bars to actually converge to correct value. Probably around 50 or so.

1 Like

I am using the Investing data that shows the current progress bars (they are updated every 15 minutes). I have tried checking the box "Use QuickAFL" and the result is the same.

image

image

Ok thanks - I see what you mean.

Try this:

// Stochastic(89)
periods = Param( "Periods", 89, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );

TimeFrameSet( inMonthly); // switch to Monthly
myStochK89 = StochK(89, Ksmooth);
TimeFrameRestore(); // restore time frame to original

myStochK89_Monthly = TimeFrameExpand(myStochK89, inMonthly, expandFirst);

// Capitalization
Cap = Ref(V*C, -1); 

SetSortColumns(-4); 
AddTextColumn(FullName(),"Name");
AddColumn(myStochK89_Monthly, "Stoch(89)");
AddColumn(Cap,"Cap",1.0);

Filter = myStochK89_Monthly < 90 AND Cap > 1000000;
1 Like

Works !!!!
Thank you very much for the time you have dedicated me, if we lived in the same city I would be happy to invite you to some beers but that is not possible, however I do wish you have a happy and profitable day. Thank you.

1 Like