Simple Coding Help - No Promise.

dell

Well-Known Member
hi ,
suppose if we want to take signals of our sys on any particular day , let us say , if choose wednesday ,
so we want that if our system generates a signal and that day was wednesday , than only take that signal otherwise left that one ......
so for do this what lines of codes are needed ?
 

pratapvb

Well-Known Member
hi ,
suppose if we want to take signals of our sys on any particular day , let us say , if choose wednesday ,
so we want that if our system generates a signal and that day was wednesday , than only take that signal otherwise left that one ......
so for do this what lines of codes are needed ?
just add dayofweek() == 4 to the condition

4 for wednesday
 

pratapvb

Well-Known Member
Wondering if anyone could help me with this. I just want to trade multiple stocks at the same time.
no idea abhig...not much into exploration and auto trading
 

manishchan

Well-Known Member
Hi Pratapbhai, Happy, (or anyone active here can help)

I want to use use this STOCH in multiple timeframe. Can you help with re-coding.

_SECTION_BEGIN("Stochastic Slow"); periods = Param( "Periods", 8, 1, 200, 1 ); Ksmooth = Param( "%K avg", 3, 1, 200, 1 ); Plot( StochK( periods , Ksmooth), "%K"+_PARAM_VALUES(), ParamColor( "%K color", colorCycle ), ParamStyle("%K style") ); Dsmooth = Param( "%D avg", 4, 1, 200, 1 ); Plot( StochD( periods , Ksmooth, DSmooth ), "%D"+_PARAM_VALUES(), ParamColor( "%D color", colorCycle ), ParamStyle("%D style",styleDashed) ); _SECTION_END();
 

manishchan

Well-Known Member
Thank you abhi. I'm not getting the desired result. Not sure if explained it better. Here is what I'm in need of. Let's say I have 3 min chart open. Now in the lower pane, I want to view the STOCH of 5 min, 15 min or may be 30 min (would like to have change option as required in param if possible) not 3 min. Also, I didn't get the bold part.

Thanks for the help !

You can repeat the code as many times, with as many time frames you like. And change the time frame using the TimeFrameSet() function.

Code:
TimeFrameSet( in1minute );
_SECTION_BEGIN("Stochastic Slow 1min");
periods = Param( "Periods", 8, 1, 200, 1 ); Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Plot( StochK( periods , Ksmooth), "%K"+_PARAM_VALUES(), ParamColor( "%K color", colorCycle ), ParamStyle("%K style") );
Dsmooth = Param( "%D avg", 4, 1, 200, 1 );
Plot( StochD( periods , Ksmooth, DSmooth ), "%D"+_PARAM_VALUES(), ParamColor( "%D color", colorCycle ), ParamStyle("%D style",styleDashed) );
_SECTION_END();
TimeFrameRestore();
 

pratapvb

Well-Known Member
Hi Pratapbhai, Happy, (or anyone active here can help)

I want to use use this STOCH in multiple timeframe. Can you help with re-coding.

_SECTION_BEGIN("Stochastic Slow"); periods = Param( "Periods", 8, 1, 200, 1 ); Ksmooth = Param( "%K avg", 3, 1, 200, 1 ); Plot( StochK( periods , Ksmooth), "%K"+_PARAM_VALUES(), ParamColor( "%K color", colorCycle ), ParamStyle("%K style") ); Dsmooth = Param( "%D avg", 4, 1, 200, 1 ); Plot( StochD( periods , Ksmooth, DSmooth ), "%D"+_PARAM_VALUES(), ParamColor( "%D color", colorCycle ), ParamStyle("%D style",styleDashed) ); _SECTION_END();
should work though just put it together now during mkt...if any issues let me know

Code:
_SECTION_BEGIN("Stochastic Slow"); 

tf = Param("TF", 5, 1, 10000, 1) ;

periods = Param( "Periods", 8, 1, 200, 1 ); 
Ksmooth = Param( "%K avg", 3, 1, 200, 1 ); 

Dsmooth = Param( "%D avg", 4, 1, 200, 1 ); 
expandmode = expandFirst ;

tfs = tf * in1Minute ;

TimeFrameSet(tfs) ;

stck = StochK( periods , Ksmooth) ;
stcd = StochD( periods , Ksmooth, DSmooth ) ;

TimeFrameRestore() ;

stcke = TimeFrameExpand(stck, tfs, expandmode) ;
stcde = TimeFrameExpand(stcd, tfs, expandmode) ;


Plot( stcke, "%K"+_PARAM_VALUES(), ParamColor( "%K color", colorCycle ), ParamStyle("%K style") ); 
Plot( stcde, "%D"+_PARAM_VALUES(), ParamColor( "%D color", colorCycle ), ParamStyle("%D style",styleDashed) ); 

_SECTION_END();
 

manishchan

Well-Known Member
Working excellent. Thank you so very much !! :thumb:

should work though just put it together now during mkt...if any issues let me know

Code:
_SECTION_BEGIN("Stochastic Slow"); 

tf = Param("TF", 5, 1, 10000, 1) ;

periods = Param( "Periods", 8, 1, 200, 1 ); 
Ksmooth = Param( "%K avg", 3, 1, 200, 1 ); 

Dsmooth = Param( "%D avg", 4, 1, 200, 1 ); 
expandmode = expandFirst ;

tfs = tf * in1Minute ;

TimeFrameSet(tfs) ;

stck = StochK( periods , Ksmooth) ;
stcd = StochD( periods , Ksmooth, DSmooth ) ;

TimeFrameRestore() ;

stcke = TimeFrameExpand(stck, tfs, expandmode) ;
stcde = TimeFrameExpand(stcd, tfs, expandmode) ;


Plot( stcke, "%K"+_PARAM_VALUES(), ParamColor( "%K color", colorCycle ), ParamStyle("%K style") ); 
Plot( stcde, "%D"+_PARAM_VALUES(), ParamColor( "%D color", colorCycle ), ParamStyle("%D style",styleDashed) ); 

_SECTION_END();
 

Similar threads