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
Lol fair enough.
I modify lots, take profit and stop loss? I delete and re-open an order until it is triggered or cancelled. I've tried this, but it doesn't seem to work? Not sure if it has something to do with comparing the doubles? (Not sure what you mean by that? NormalizeDouble?)
Yea, I don't quite know why I was posting that part of the code... (facepalm) I think I have managed to sort out the error 1 message now.
Call it once, at the beginning of start(). Return if false.
Would you mind elaborating on this? This is where I am stuck on at the moment. I have experimented for a long time on this now.
At the moment, I am calling "IsNewCandle()" from the int start() and then "CheckForMaTrade();" which if "CheckForMaTrade()" returns true, it will pass over control to an order send function...
When it gets passed over to this order send function from "CheckForMaTrade()" it is NOT checking every hour bar close to modify its order (which is what I am wanting it to do.) Instead, I am finding it hard to understand how, but it is doing it on random H1 bar closes.
When it does the modify, it is OrderDelete() the pending Order, and then re-opening a new order with the new stops, lots, and targets... (80-90% of the time it will need to recalibrate the order relative to the MA, as this is where the stop goes before the order is triggered.)
How do I use "IsNewCandle()" in conjunction with the following code to make sure that on every new candle, the order is deleted, and a new order is placed...?
I've tried calling "Modify_Order();" which is a void with a for loop to get the open order AFTER "IfIsNewCandle()" within the "int start()" section, but I am having no luck with it - It does the job, but it's not as consistent with picking up the correct number of trades it should do through-out the back-test, and instead of being slightly better results (which it should most definitely be), it is dramatically worse?
Man this is frustrating me lol.
Tell me about it . . . I've just spent 2 hours tracking down a bug in my code which was as a result of TimeDayOfWeek(TimeCurrent()) returning the wrong day number . . . then I realised I took my test terminal offline . . . on Monday.
This being called on every "IsNewCandle()" - So when it is correct, it will send an "Order Send" function via "OrderEntry(1)". When it reaches OrderEntry(1) (which is the code I posted in previous post), it will push out a pending order, BUT it will NOT calibrate the order based upon EACH H1 bar close, because the OrderEntry(1) is a void.
So, forgive me if I am sounding stupid (as I have not quite got this in my own head yet!), but why when I try to call the OrderEntry(1) from Int Start(), If( IsNewCandle(), it still will not update or modify the current pending order?
If( !IsNewCandle() ) return; <<<< Does that mean, if it is NOT a new candle, right? Are you suggesting I put it beneath that and brace the OrderEntry(1) call from there? (sorry for being a little slow :s)
Tell me about it . . . I've just spent 2 hours tracking down a bug in my code which was as a result of TimeDayOfWeek(TimeCurrent()) returning the wrong day number . . . then I realised I took my test terminal offline . . . on Monday.
I've started to realise how it's not a case of just writing a system and happy days... I was never that naive anyway, but I am starting to realise how every little thing I do is incredibly important, how I write it, but not only that, remembering what I've changed (Hence why I am now saving Version_1, version_2 and so forth lol)