I wrote some code that is conditional on whether the calculation is for real time data or historical data, and some conditional values.
The issue I'm having is that when the values DH=0 and DL = 0 are true, the code executes the second statement (correct). But once it has done that, and changed DH and DL to real values, for some reason it executes the first conditional statement's function, but doesn't execute any of the print statements. And this happens on the same bar number as the second conditional statement is executed for.
The way I have it programmed (see below), it should not loop around and execute Conditional Statement A, on the same bar that Conditional Statement B is executed on. I'm thinking this may be a problem with MC, but I wanted to see if anyone else has had a similar problem.
My code structure is as follows:
Code: Select all
if ((GetAppInfo(aiRealTimeCalc)=0 and DH<> 0 and DL<>0)
or(GetAppInfo(aiRealTimeCalc)=0
AND (((PS =1 and PS2 = 1) or (PS=2 and PS2 = 2)) and (H[1]<H) and (L[1]>L))))
then
begin
//There is a function here
Print ("In Conditional Statement A");
end;
//**********************************************************
if ((GetAppInfo(aiRealTimeCalc)=0 and DH = 0 and DL = 0)) or (GetAppInfo(aiRealTimeCalc)=1) then
begin
// Function here that calculates the values for DH and DL
Print ("In Conditional Statement B");
end;
//--------------------------------------------------------------------------
// PS values are calculated by a function and done for all conditions (i.e. outside the conditional functions.