Scripting various timeframes

Hi Optuma community,

I am looking to run a multiple codes scan in multiple time frames, for example 14 period ADX > 25 in both the daily and weekly time frame. I have my data timeframe set to date range = last bar, data timeframe = 1 week and the scan works perfectly until I add the daily line in, at which point it returns nothing.

any help much appreciated as always
Dean

Hi Dean,

Please include the code which works and then the code which does not. It takes too long for anyone to build this from a description and then we do not know if we have it right or not. Also, please make sure that you use the “<> Code” button when you want to paste in the code.

All the best

Mathew

Hi Matthew,

Thanks for getting back to me. After further investigation it seems that both of the below scripts work as expected when I set the Date Range to Yesterday, however when I use Last Bar, the Weekly scan works as expected but the Daily + Weekly scan does not.

Weekly Only:

ADX(BARS=8, ADXRBARS=8) > 30 and ADX(Week(PERIODAMOUNT=1), DEFAULT=DMPlus, BARS=8, ADXRBARS=8) > ADX(DEFAULT=DMMinus, BARS=8, ADXRBARS=8) and JDKRS().Heading > 10 and JDKRS().Heading < 100 and JDKRS().Velocity > 1.5 and ADX(BARS=8, ADXRBARS=8) IsUp

Daily + Weekly
ADX(BARS=8, ADXRBARS=8) > 30 and ADX(Week(PERIODAMOUNT=1), DEFAULT=DMPlus, BARS=8, ADXRBARS=8) > ADX(DEFAULT=DMMinus, BARS=8, ADXRBARS=8) and ADX(Day(PERIODAMOUNT=1), BARS=8, ADXRBARS=8) > 30 and JDKRS().Heading > 10 and JDKRS().Heading < 100 and JDKRS().Velocity > 1.5 and ADX(BARS=8, ADXRBARS=8) IsUp

thanks,
Dean