Hi Peeps,
I have been trying to get this to work but I’m not having any success…
IF c1 AND NOT LongOnMarket THEN
BUY 2 PERPOINT AT MARKET
ENDIF
//let's add another order while price continue to move lower (more than 10 points) than the last order taken with a condition of 5 bars elapsed since then
IF TRADEINDEX(1)>5 AND Close-TRADEPRICE(1)>10 AND C1 AND LongOnMarket THEN
BUY 2 PERPOINT AT MARKET
ENDIF
When I run this – in the Orders List – I get an initial Trade of 2 perpoint followed by 1 perpoint ( IG Index is a minimum of 2 ) – so this order will not be executed.
I’m slightly confused why it isn’t accepting the “2” as opposed to “1” and where it is referencing “1” from
** Also when I go to – Auto Trade this it tells me
“The following changes must be applied before sending the code to pro order trading systems with orders that partially close a position cannot be sent to project for example cell-free shares at market make sure that no quantity is specified in the instructions to close positions brackets in this case the instruction closest in tile position) example sell at market return X it short at 1.5 limits ”
I’ve tried all various coding terms and it’s still sending me this notice.
Many thanks for any suggestions..
Regards
Hugh
I’m sorry, but the code you are using is wrong, and it is my fault 🙁 Because this code came from the documentation, I changed it recently into the TRADEINDEX term page but not in the TRADEPRICE one which share this same code example.
To add orders when there is already 5 bars elapsed, the code should be this one :
IF BARINDEX-TRADEINDEX(1)>5 AND Close-TRADEPRICE(1)>10 AND LongOnMarket THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
For the “perpoint” problem, if you change the “perpoint” with “share”, does the problem still exist?
It is not possible to partially close an order, so I believe you try to do it in your code, that’s why you get this error message. For example, if you BUY 2 SHARES somewhere in your code, then you can’t SELL 1 SHARE elsewhere, if you want to close your buy orders, you must use SELL AT MARKET (all orders will be closed instead of fractionnal one which is not possible).
Hi Nicolas
Thank you for your sterling work.
I’ve edited the coding as follows:
IF c1 AND NOT LongOnMarket THEN
BUY 2 PERPOINT AT MARKET
ENDIF
//let's add another order while price continue to move lower (more than 10 points) than the last order taken with a condition of 5 bars elapsed since then
IF BARINDEX-TRADEINDEX(1)>5 AND Close-TRADEPRICE(1)>10 AND LongOnMarket THEN
BUY 2 PERPOINT AT MARKET
ENDIF
At the moment it appears I’m not getting the subsequent order to the initial order.
Picture attached.
Regards
Hugh
p.s. going to try to replace per point with contract ………….
Ok, so what you want to do here is averaging down your first order? Buying lower than your initial buy order.
If the answer is yes there is a wrong calculation here:
Close-TRADEPRICE(1)>10
This should be:
TRADEPRICE(1)-Close>10
Also, you should convert your “10” points value to the instrument point value accordingly and to be “universal” with any instrument:
TRADEPRICE(1)-Close>10*pipsize
Hi Nicolas
– Thank you.
You are a font of knowledge.
I’ll make some amendments later & confirm.
Regards
Hugh
Hi
Using 1 Min Chart
I was trying to do this code so that after the first order it will only repeat the order if the price has moved lower/higher .
(Averaging up or down as per Nicolas’s message)
I keep getting a warning sign – code not working as per picture
Think I got it work now…….
IF c1 AND NOT LongOnMarket THEN
BUY 2 PERPOINT AT MARKET
ENDIF
IF C1 AND TRADEPRICE(1)- Close>25 AND LongOnMarket THEN
BUY 2 PERPOINT AT MARKET
ENDIF