Optuma Forums › Optuma Scripting › Script that references variables
- This topic has 1 reply, 2 voices, and was last updated 1 month ago by
Mathew.
-
AuthorPosts
-
December 16, 2020 at 7:01 am #61765
Michael
- Topics: 5
- Replies: 1
- Posts: 6
123I am getting all zero values when I try to reference the variables “FollowThrough” and “BSDailyon” and “BS”. It seem like the script does not like moving back and forth between these variables. I have tried numerous different methodologies and different orders but no luck. Can you help? thank you
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //
Determine where close was in the days range
V1 = VOL(Day(PERIODAMOUNT=1));
TodayClose = CLOSE();
PriorClose = close(OFFSET=1);
Low1 = If(LOW()<PriorClose,Low(),PriorClose);
High1 = If(high()>PriorClose,High(),Priorclose);
RealRange = High1 – Low1; CloseRange= 1-abs(((TodayClose-High1)/RealRange));//////////////////////////////////////////////////////////////////////////////////////////////////////////////
123//Determine if up 1% on higher volume
// Percentage change vs. prior day- Value
PC= (CLOSE()-Close(OFFSET=1))/Close(OFFSET=1);// Higher volume than prior day- True or False
HVol = VOL() > VOL(OFFSET=1); // Percent Change over 1% for Follow Through FT. True or False PCOver1% = PC > .01;// Higher close by 1% than prior day on higher volume DailyPCFT = PCOver1% and HVol; // True false DailyPCFTCriteria = If(Offset(BS,, OFFSET=1) ==1, DailyPCFT, 0); PCFT = ACC(DailyPCFTCriteria,, RANGE=Look Back Period, BARS=365);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Distribution days
DailyDistD = PC < .002 and HVol;
DailyCountCriteria = If(OFFSET(BS, OFFSET=1) =1, DailyDistD,0); // if BS on count DailyDistD
DistCount = ACC(DailyCountCriteria, RANGE=Look Back Period, BARS=25); // add all DailyDistD over last 25 days When BuySwith On//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //
Determine if Buy Switch is on/off// Is it a RallyDay
RallyDay = (Offset(BS, offset = 1) == 0) and (Close() IsUp); // Prior Day buy signal off and close up for day// Buy Switch BS On or Off
BSDailyOff = (DistCount> 5); // Turn off if distr count goes above 5
BSDailyOn = (FollowThrough ==1); // Higher close by 1% than prior day on higher volume and prior day buy switch off and rally day 4 to 16 days ago
BS = switch(BSDailyOn, BSDailyOff); // Is overall Buy Switch on or off// Follow Through is prior day Buy Switch off AND Price Change more than 1% AND a rally day 4 to 16 days ago
FollowThrough = ((Offset(BS, offset = 1)) == 0) and (DailyPCFT == 1) and ((Offset(RallyDay, OFFSET=4) ==1) or (Offset(RallyDay, OFFSET=5) ==1) or (Offset(RallyDay, OFFSET=6) ==1) or (Offset(RallyDay, OFFSET=7) ==1) or (Offset(RallyDay, OFFSET=8) ==1) or (Offset(RallyDay, OFFSET=9) ==1) or (Offset(RallyDay, OFFSET=10) ==1) or (Offset(RallyDay, OFFSET=11) ==1) or (Offset(RallyDay, OFFSET=12) ==1) or (Offset(RallyDay, OFFSET=13) ==1) or (Offset(RallyDay, OFFSET=14) ==1) or (Offset(RallyDay, OFFSET=15) ==1) or (Offset(RallyDay, OFFSET=16) ==1));BS;
123December 17, 2020 at 8:34 am #61775Mathew
- Topics: 32
- Replies: 1,650
- Posts: 1,682
Hi Michael,
This is all a little too complex for us to look at without a consult. (optuma.com/consults)
What I would suggest first is that you break it up into separate sections and make sure that each part is working as you expect.
One other thing to make it easier to read is that you can swap (Offset(BS, offset = 1) with BS[1]
Also look at the TimeSinceSignal function (https://help.optuma.com/kb/faq.php?id=1030) using the offset allows you to see how many days between signals (which I think you are trying to do).
The other issue I see is that you are using the FollowThrough value before it has been set.
Hopefully, that will help you get going, if you need more help with this you’ll have to organise a consult with one of the guys.
All the best
Mathew
1 user thanked author for this post.
-
AuthorPosts
- You must be logged in to reply to this topic.