Optuma Forums › Optuma Scripting › Script Assistance › Reply To: Script Assistance
January 12, 2021 at 12:04 pm
#61989

- Topics: 32
- Replies: 1,654
- Posts: 1,686
Hi Marie,
You do not need to specify the daily time frame if you are using this on Day Charts and scanning on daily data ( which is the default).
I like to break up scans into separate items and put them in variables like “C1” which in my mind I call “Condition 1”
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// 50MA<20MA c1 = MA(Bars=50) < MA(Bars=20); // 20MA<7MA c2 = MA(Bars=20) < MA(Bars=7); // Price< Highest High (Last 52weeks) c3 = CLOSE() < HIGHESTHIGH(BACKTYPE=Weeks, BARS=52); // Price uptrending // I'm not sure how you define this. You could use ADX for trend strength, or a Gann Swing to define trend direction. c4 = GANNSWING(SWINGCOUNT=2) IsUp; //Price uptrend change >10% (Last 14days) c5 = CHANGE(INT_COUNT=14, INT_TYPE=Day) > 10; // now we combine them all with ANDS since we want all to be true c1 AND c2 AND c3 AND c4 AND c5 |
What I like about using the variables is if there are any issues, I can go line by line and examine each item to be sure that it is right. eg If I wanted to check my Gann Swing rule, I can comment out the last line and just put c4 as the output like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
// 50MA<20MA c1 = MA(Bars=50) < MA(Bars=20); // 20MA<7MA c2 = MA(Bars=20) < MA(Bars=7); // Price< Highest High (Last 52weeks) c3 = CLOSE() < HIGHESTHIGH(BACKTYPE=Weeks, BARS=52); // Price uptrending c4 = GANNSWING(SWINGCOUNT=2) IsUp; //Price uptrend change >10% (Last 14days) c5 = CHANGE(INT_COUNT=14, INT_TYPE=Day) > 10; // now we combine them all with ANDS since we want all to be true //c1 AND c2 AND c3 AND c4 AND c5 c4 |
Hope that helps point you in the right direction
Mathew