MrBruceKA
New member
I would use a FOR. . . NEXT or DO . . . WHILE statement, if I was writing in BASIC programming language. However, I can only find a FOLD statement in thinkScript to iterate through statements.
Could someone convert these SCAN statements into a FOLD statement for me. BUT, more important, please tell me, in detail, what is going on. I can't understand the example giving in the TOS Help.
Thanks for the education
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
input PSprd = 3;
def Pcnt = PSprd/100;
input RunLen = 8;
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# Get the average of the midpoints
def MidPoint = (Open+Close)/2;
def RunAvg = Average(MidPoint,RunLen);
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# Calculate the Percentages
def P1 = AbsValue((MidPoint[(RunLen-1)]-RunAvg)/RunAvg);
def P2 = AbsValue((MidPoint[(RunLen-2)]-RunAvg)/RunAvg);
def P3 = AbsValue((MidPoint[(RunLen-3)]-RunAvg)/RunAvg);
def P4 = AbsValue((MidPoint[(RunLen-4)]-RunAvg)/RunAvg);
def P5 = AbsValue((MidPoint[(RunLen-5)]-RunAvg)/RunAvg);
def P6 = AbsValue((MidPoint[(RunLen-6)]-RunAvg)/RunAvg);
def P7 = AbsValue((MidPoint[(RunLen-7)]-RunAvg)/RunAvg);
def P8 = AbsValue((MidPoint[(RunLen-8)]-RunAvg)/RunAvg);
# See if all are below the PSprd value
Def Ans = P1<Pcnt And P2<Pcnt And P3<Pcnt And P4<Pcnt And P5<Pcnt And P6<Pcnt And P7<Pcnt And P8<Pcnt;
Could someone convert these SCAN statements into a FOLD statement for me. BUT, more important, please tell me, in detail, what is going on. I can't understand the example giving in the TOS Help.
Thanks for the education
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
input PSprd = 3;
def Pcnt = PSprd/100;
input RunLen = 8;
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# Get the average of the midpoints
def MidPoint = (Open+Close)/2;
def RunAvg = Average(MidPoint,RunLen);
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# Calculate the Percentages
def P1 = AbsValue((MidPoint[(RunLen-1)]-RunAvg)/RunAvg);
def P2 = AbsValue((MidPoint[(RunLen-2)]-RunAvg)/RunAvg);
def P3 = AbsValue((MidPoint[(RunLen-3)]-RunAvg)/RunAvg);
def P4 = AbsValue((MidPoint[(RunLen-4)]-RunAvg)/RunAvg);
def P5 = AbsValue((MidPoint[(RunLen-5)]-RunAvg)/RunAvg);
def P6 = AbsValue((MidPoint[(RunLen-6)]-RunAvg)/RunAvg);
def P7 = AbsValue((MidPoint[(RunLen-7)]-RunAvg)/RunAvg);
def P8 = AbsValue((MidPoint[(RunLen-8)]-RunAvg)/RunAvg);
# See if all are below the PSprd value
Def Ans = P1<Pcnt And P2<Pcnt And P3<Pcnt And P4<Pcnt And P5<Pcnt And P6<Pcnt And P7<Pcnt And P8<Pcnt;