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
Does MathFloor round decimal places DOWN to the nearest WHOLE number?
MathFloor() does what it says in the documentation . . . "The MathFloor function returns a numeric value representing the largest integer that is less than or equal to x."
Does FirstTarget make sense as a custom parameter within "OrderClose()" - Assuming "sizeClose" was correct? (see quoted code)
No . . . you have this:
when you probably mean this . . .
FirstTarget = OrderOpenPrice() + ( ( OrderTakeProfit()-OrderOpenPrice() ) / 2 ) ;
Use brackets (and spaces) to make things clear and unambiguous.
Your code did not help - sorry.
Why ? is it wrong ? in what way ?
Can you print custom variables? If so, I must be doing it wrong as it is not showing up in the journal.
Yes, you can print any variables . . . what are you doing ? show your code.
With regards to printing custom variables, how would I go about doing this for "FirstTarget_Buy"?
I am going to spend time going through all my code and printing a lot out - I understand how to do it with bools and ints (integer -1 fails and bool is a true or false statement - easy.) but I do not understand how to do it when you assign functions to a custom variable?
Thanks for shedding light on "FirsTarget" formula above! Sorry, I meant to say that your code did not help in a sense that I am not understanding how to put the formula together... I find it really counter intuitive - You would have thought that calling "OrderSelect" would allow you to simply see what the lot size was on that tickorder... and then simply split it...
Sorry for coming across like a complete moron!
Sorry for coming across like a complete moron!
Not at all, you just need to find your blind spot and enlighten it, once you have you will wonder why you found it so hard, everything is easy when you know how.
With regards to printing custom variables, how would I go about doing this for "FirstTarget_Buy"?
I am going to spend time going through all my code and printing a lot out - I understand how to do it with bools and ints (integer -1 fails and bool is a true or false statement - easy.) but I do not understand how to do it when you assign functions to a custom variable?
I meant to say that your code did not help in a sense that I am not understanding how to put the formula together... I find it really counter intuitive - You would have thought that calling "OrderSelect" would allow you to simply see what the lot size was on that tickorder... and then simply split it...
You can simply OrderSelect the order, the use OrderLots() and divide by two . . . you can do that, and in many situations it will work. I write code fo all cases I can foresee so that I don't have to continually fix it when it breaks . . .
If your position size is 2.0 lots; this divided by two is 1.0 lots and this will work . . .
If your position size is 0.3 lots; this divided by two is 0.15 lots and this will be an invalid position size if MODE_LOTSTEP is 0.1 . . . you can use 0.1 or 0.2 NOT 0.15 so you need to code this check and adjustment.
What you have here will not work in all cases . . .
Ahhhh! I've just spent last 15-20 minutes wacking prints all over the place - I am starting to understand where I am going wrong. I am basically selecting the PENDING order... HOWEVER, because it is a pending order, at the point I select it, there is a pretty high chance the OrderLots, stop and targets would have changed, therefore I'll need to put it in a loop to make it synced with how my pending orders are being constantly calculated before they trigger.
That darn doubletostr :P - Spot on RaptorUK! I can now see that this is calculated correctly, thanks to your adjustment :)
I think I know how to do most of it now - Just out of curiosity, what "if" statement would work to ONLY call the order that has been TRIGGERED. At the moment, I have it calling upon when I have a market order open, but I am trying to figure out how I call upon when the pending order has been triggered?
The code below and the corresponding "if" statement just seems to call upon open pending orders. Just want a way to "go to" a specific custom function (void for example) on the basis that an order has been triggered? (if that makes sense!)
Thank you for clearing so much up for me :)
Ahhhh! I've just spent last 15-20 minutes wacking prints all over the place - I am starting to understand where I am going wrong.
Easy when you know how
I think I know how to do most of it now - Just out of curiosity, what "if" statement would work to ONLY call the order that has been TRIGGERED. At the moment, I have it calling upon when I have a market order open, but I am trying to figure out how I call upon when the pending order has been triggered?
When a Pending Order has been triggered it will become an OP_BUY or OP_SELL, so . . .
if(OrderType() == OP_BUY || OrderType() == OP_SELL) { }
One tip, use m o r e spaces . . . when you get a divide by zero error and you want to find where it is happening it is easy to search for space/space and just find your divisions instead of all your comments . . . so I use spaces around = + - / % etc.
Good tip - I will do! Thank you for your help :) I'll post back if I manage to do it!
I am getting no information regarding the prints? Absolutely nothing is coming up in the Journal. I assume this is because nothing is being selected as far as the OrderType goes right from the first "if" statement? From what I can see here on the code, I would have thought that I am not far off, at least...?
Ok, I'm back! ... Not so good news though - I have tried and tested multiple variations of code with no luck. This is where I am at right now.
I am getting no information regarding the prints? Absolutely nothing is coming up in the Journal. I assume this is because nothing is being selected as far as the OrderType goes right from the first "if" statement? From what I can see here on the code, I would have thought that I am not far off, at least...?
How are you selecting the Order before doing this ?
if(OrderType() == OP_BUY ){
You still have issues here
Why not . . .
2013.07.31 11:13:52 2013.02.01 16:00 trendfishing_play_ground EURUSD,H1: Order Select returned the error of 0 // Not sure what is going on here? 2013.07.31 11:13:52 2013.02.01 16:00 trendfishing_play_ground EURUSD,H1: The Lots to close is: 0.09000 // This is the right calculation based // upon the total lots opened on a pending order - to half. 2013.07.31 11:13:52 2013.02.01 16:00 trendfishing_play_ground EURUSD,H1: The Lotstep is: 0.01000 2013.07.31 11:13:52 2013.02.01 16:00 trendfishing_play_ground EURUSD,H1: The minimum lots are: 0.01000 2013.07.31 11:13:52 2013.02.01 16:00 trendfishing_play_ground EURUSD,H1: FirstTarget_Buy: 1.37931 // This price is also correct.