MQL5 Question.
Been awhile as have learned to learn lol although sometimes the smallest thing can stump...
Have been googling for two days now and cant figure this out and it seems basic.
Within the void OnTick()
I would like to create a variable int a;
.
Lets say it starts out with no value int a;
.
Then I test condition if a
is NULL
or ||
equals 1
Like So.. if (a==NULL || a==1)
Which should always return true the first time the if statement runs due to NULL
.
I then assign a value to the variable a=0;
.
So now a
should == 0
.
This should trigger the else if(a==0)
the next time OnTick()
is called.
At which point I then assign a=1;
.
Resulting in the if
being triggered next time round.
Etc etc Ad Infinitum. Constantly checking and assigning values. Switching between 0 and 1.
void OnTick()
int a;
if (PositionsTotal() < 1)
{
if(a==NULL || a==1)
{
a=0;
}
else if(a==0)
{
a=1;
}
I do not know what is going on but I am getting a long string of numbers which switches between negatives and positives always with the same number -12345678
or 12345678
.
Or a Random positive 3 digit number which never changes???
So far I have had both 303 and 597.
Beyond frustrating and most likely answered somewhere else.
Just not sure how to phrase the search term...
Brainfart..
Thanks for you help.
Aucun commentaire:
Enregistrer un commentaire