Ok - I am getting pretty close to getting this grounded (just been writing down things I need to fix / how / and logic applied)
One area I am struggling with is how I check every single tick ONCE the OP_BUYSTOP has been triggered into an OP_BUY. I am for the time being going to continue with slapping one trade in and doing partial closes - purely on the basis that I am confident I have nearly done it?
I've really appreciated the contribution on this thread - it's massively helped me understand a lot :) so thanks again for your time!!
DomGilberto: Ok - I am getting pretty close to getting this grounded (just been writing down things I need to fix / how / and logic applied)
One area I am struggling with is how I check every single tick ONCE the OP_BUYSTOP has been triggered into an OP_BUY.
You can't, you have to check every tick to see if the OP_BUYSTOP has triggered to an OP_BUY . . . but what you can do is check if you have any OP_BUYs, if you don't then you can simply return(0); and avoid the rest of the code.
Hold on, so I cannot check every tick? I'm wanting to make sure the partial close is closed as soon as the bid is == to the price I want it to? At the moment it is closing if Bid == the exit price on an hourly basis - which you spotted out with "IfIsNewCandle"? Meaning it's a really funny and strange way of closing it...
Lets say my "OP_BUYSTOP" has triggered into a "OP_BUY", can I then check every tick so that my OrderClose() function will close at my desired price AS SOON as the bid is == to the exit price specified?
Lets say my "OP_BUYSTOP" has triggered into a "OP_BUY", can I then check every tick so that my OrderClose() function will close at my desired price AS SOON as the bid is == to the exit price specified?
Yes, you MUST check every tick . . . but what I was saying is that you don't need to do everything for each tick . . . you said "how I check every single tick ONCE the OP_BUYSTOP has been triggered into an OP_BUY." what I meant is that you can't only check on every tick ONCE the OP_BUYSTOP becomes an OP_BUY, you have to check if this has happened on every tick.
DomGilberto: Ah, yup I got you - my mistake. Read what you wrote wrong.
I don't know how to do that. Can you point me in the right direction?
Just a simple loop, like you already have, looping through the open orders and checking the OrderType() . . . there may be little advantage, in terms of performance, in adding this to your code, without checking I can't say for sure.
DomGilberto: Sorry, what I meant was, is there an in-built function within MQL4 that I need to use, in order to check every tick?
Nope, start() is called every tick . . . but currently you only call CheckForMaTrade() when there is a new candle ( IsNewCandle() ) you need to do it for every tick.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
DomGilberto: C) Not sure what difference this makes?
One area I am struggling with is how I check every single tick ONCE the OP_BUYSTOP has been triggered into an OP_BUY. I am for the time being going to continue with slapping one trade in and doing partial closes - purely on the basis that I am confident I have nearly done it?
I've really appreciated the contribution on this thread - it's massively helped me understand a lot :) so thanks again for your time!!
Ok - I am getting pretty close to getting this grounded (just been writing down things I need to fix / how / and logic applied)
One area I am struggling with is how I check every single tick ONCE the OP_BUYSTOP has been triggered into an OP_BUY.
You can't, you have to check every tick to see if the OP_BUYSTOP has triggered to an OP_BUY . . . but what you can do is check if you have any OP_BUYs, if you don't then you can simply return(0); and avoid the rest of the code.
Does that help ?
Lets say my "OP_BUYSTOP" has triggered into a "OP_BUY", can I then check every tick so that my OrderClose() function will close at my desired price AS SOON as the bid is == to the exit price specified?
Lets say my "OP_BUYSTOP" has triggered into a "OP_BUY", can I then check every tick so that my OrderClose() function will close at my desired price AS SOON as the bid is == to the exit price specified?
I don't know how to do that. Can you point me in the right direction?
Ah, yup I got you - my mistake. Read what you wrote wrong.
I don't know how to do that. Can you point me in the right direction?
Sorry, what I meant was, is there an in-built function within MQL4 that I need to use, in order to check every tick?