I'm building a string that contain information on bar and past pivot price. The last 2 elements of the string are not the good value.
Code: Select all
If barstatus[1] = 2 then begin
LSL1 = PivotLowVS(1, Low, 1, 1, 21);
LSL2 = PivotLowVS(2, Low, 1, 1, 21);
LSH1 = PivotHighVS(1, High, 1, 1, 21);
LSH2 = PivotHighVS(2, High, 1, 1, 21);
end;
//Print (LSl1:5:5, spaces(1), lsl2:5:5); // for debug only
print ("1 LSH1: ",lsh1:5:5, " LSH2 ", lsh2:5:5); // These are the number value before being transform in a string
DataString = Numtostr(Open,5) + coma + NumtoStr(High,5) + coma + NumtoStr(Low,5) + coma + NumToStr(Close,5) + coma +
Numtostr(Open[1],5) + coma + NumtoStr(High[1],5) + coma + NumtoStr(Low[1],5) + coma + NumToStr(Close[1],5) + coma +
NumtoStr(LSL1,5) + coma + NumToStr(LSL2,5) + coma + NumToStr(LSH1,5) + coma + NumToStr(LSH2,5);
print ("2 LSH1: ",lsh1:5:5, " LSH2 ", lsh2:5:5); // These are the same variable Number after
Print (datastring);
[code]If barstatus[1] = 2 then begin
LSL1 = PivotLowVS(1, Low, 1, 1, 21);
LSL2 = PivotLowVS(2, Low, 1, 1, 21);
LSH1 = PivotHighVS(1, High, 1, 1, 21);
LSH2 = PivotHighVS(2, High, 1, 1, 21);
end;
//Print (LSl1:5:5, spaces(1), lsl2:5:5); // for debug only
DataString = Numtostr(Open,5) + coma + NumtoStr(High,5) + coma + NumtoStr(Low,5) + coma + NumToStr(Close,5) + coma +
Numtostr(Open[1],5) + coma + NumtoStr(High[1],5) + coma + NumtoStr(Low[1],5) + coma + NumToStr(Close[1],5) + coma +
NumtoStr(LSL1,5) + coma + NumToStr(LSL2,5) + coma + NumToStr(LSH1,5) + coma + NumToStr(LSH2,5);
print (lsh1:5:5, " ", lsh2:5:5);
Print (datastring);
The weird behavior is from the last 2 elements of the string. They represent string value of the last 2 pivots high. It is not the good value that came out of the NumToString.1 LSH1: 1.42150 // LSH2 1.42330
2 LSH1: 1.42150 // LSH2 1.42330
1.42045,1.42055,1.42030,1.42050,1.42085,1.42085,1.42035,1.42045,1.42080,1.42170,1.42045,1.42055
LSH1 = 1.42150 String = 1.42045
LSH2 = 1.42330 String = 1.42055
I'm confuse. Hope I'm clear enough
Any help appreciated
Martin