When to define numeric variables with -.999 and .999
Posted: Sep 02 2022
Hello code gurus,
Can someone please explain why it is necessary or good practice to define variables using -.99999 and .99999 when calling them in a for loop or as trade signals?
Please see the following code snipets:
In the first example, it seems that stop1a will always be greater than '-.999999' so that Value2 is redundant. Why do I keep seeing it in code? Is it there to prevent to prevent incorrect entries?
Any guidance is appreciated. Thank you!
Can someone please explain why it is necessary or good practice to define variables using -.99999 and .99999 when calling them in a for loop or as trade signals?
Please see the following code snipets:
Code: Select all
Value1=AvgTrueRange(ADRdays);
value2=-999999.;
end;
End;
{now add the stops}
if marketposition=1 then
begin
stop1a= EntryPrice-(stoplossADR*Value1);
if stop1a > value2 then
Begin
value2=stop1a;
stoptype="StopLoss";
Code: Select all
hh = -99999999999; ll = 99999999999;
if nSess>1 then begin
for value90 = 1 to nSess begin
hh = maxlist(hh,ohlcvalues[1+value90*4]);
ll = minlist(ll,ohlcvalues[2+value90*4]);
end;
end
Any guidance is appreciated. Thank you!