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
To check for an indicator to cross a certain threshold you need two values, the actual one and the one from the previous bar/candle.
Then the check goes like that:
if (previous_value < threshold && current_value >= threshold) upcross = true;
if (previous_value > threshold && current_value <= threshold) downcross = true;
To put it into context your code would look something like this:
I appreciate that now that I have the EMA cross more accurate how would I do about closing the order when the opposite cross occurs?
?????????
?????????
Same result
This screenshot actually says nothing.
We can't see your broken code if you do not show it. You have been asked several times now to reveal your code. If you keep it, ok but don't complain about things that won't work at your side. Bye. -
This screenshot actually says nothing.
We can't see your broken code if you do not show it. You have been asked several times now to reveal your code. If you keep it, ok but don't complain about things that won't work at your side. Bye. -
I have showed the whole code before I didnt think I needed to everytime
I have showed the whole code before I didnt think I needed to everytime
You have to show it again of course if you fixed it and it's still not working.
The code looks ok and should open trades when the fast MA crosses the slow one, that is on Mar 1st (up) and 2nd (down cross).
If it doesn't it may be for other reasons. You need to check the return value of OrderSend and GetLastError() code.
And beside that you should fix this line:
Always loop back to front:
(ignore the link to order_calc_margin, it's auto-generated by this brain-dead forum software)
You have to show it again of course if you fixed it and it's still not working.
The code looks ok and should open trades when the fast MA crosses the slow one, that is on Mar 1st (up) and 2nd (down cross).
If it doesn't it may be for other reasons. You need to check the return value of OrderSend and GetLastError() code.
And beside that you should fix this line:
Always loop back to front:
(ignore the link to order_calc_margin, it's auto-generated by this brain-dead forum software)
How do I check the value of OrderSend and GetLastError. Do I put it inside the last bracket?