You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
static int a; sits above start(){ GLOBAL VALUE
theres no difference 1 or 0. true or false
i am increasing value a after conditions take effect
When you are asking others for assistance you should make your code as easy to read as possible, that includes using true or false with bools.
Using numbers can lead to mistakes such as this
bool a=1;
bool b=-1;
if(a+b==0)
Print("a+b equals 0");
else
Print("a+b does not equal 0");
You are only increasing a if an OrderSelect fails, where does it get reset?
You do not have a loop in your code, where does it cycle through orders?
When you are asking others for assistance you should make your code as easy to read as possible, that includes using true or false with bools.
Using numbers can lead to mistakes such as this
bool a=1;
bool b=-1;
if(a+b==0)
Print("a+b equals 0");
else
Print("a+b does not equal 0");
You are only increasing a if an OrderSelect fails, where does it get reset?
You do not have a loop in your code, where does it cycle through orders?
You are only increasing a if an OrderSelect fails, where does it get reset?
a does not get reset
You do not have a loop in your code, where does it cycle through orders?
it was a mistake to write cycle but code matters not comments
Well, you obviously know everything.
Why are you asking for assistance?
Well, you obviously know everything.
Why are you asking for assistance?
i can do
OrderProfit()<0)
that works but i wanted to understand how to select last history order then determine if last history order was loss or profit
i can do
OrderProfit()<0)
that works but i wanted to understand how to select last history order then determine if it was loss or profit
That does not work as you have not selected an order. I can not think of any reason for the 2 tests to be in the same if() without an OrderSelect()
if(OrdersTotal()>0&&
a<OrdersTotal()&&
OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==0)
a++;
if(OrdersHistoryTotal()>0&&OrderProfit()<0)
Why are you showing
a<OrdersTotal()&&
OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==0)
a++;
in reponse to a comment on
OrderProfit()<0)
?
They obviously have nothing to do with each other
Why are you showing
a<OrdersTotal()&&
OrderSelect(a,SELECT_BY_POS,MODE_TRADES)==0)
a++;
in reponse to a comment on
OrderProfit()<0)
?
They obviously have nothing to do with each other
then why does it do what it does? it works inside my mt4 terminal
It may well do something, but I doubt very much that it does what you expect.
Otherwise why are you posting a questiom?
Re-write the code in a logical way so that individual blocks work with each other. Use a loop to cycle through orders and do not use a globally declared variable for the order index/
It may well do something, but I doubt very much that it does what you expect.
Otherwise why are you posting a questiom?
Re-write the code in a logical way so that individual blocks work with each other. Use a loop to cycle through orders and do not use a globally declared variable for the order index/