Posted By: slyths
[Oanda restapi]not opening more than 1 unit) - 05/15/17 18:25
Hello I'm testing the scripting language to randomly open position, then increase the lot size based on the amount of positions I have open already and if the sum of the positions are losing.
The issues are 2:
1) I cannot seem to open more than 1 of the smallest tradeable unit in oanda fxtrade, regardless of the amount of Lots I insert(Lots = 1, Lots = 6 etc etc.)
2) therefore going back to the code when there are more than 5 positions open it doesn't increase the lot size as it should, therefore it doesn't continue trading.
I need the script to do exactly what I've tried described below. I'm aware that there are different ways to open lot sizes, but i wanted to see if zorro is capable of doing it this way.
This is the code for the lot size opening:
Any help will be greatly appreciated.
The issues are 2:
1) I cannot seem to open more than 1 of the smallest tradeable unit in oanda fxtrade, regardless of the amount of Lots I insert(Lots = 1, Lots = 6 etc etc.)
2) therefore going back to the code when there are more than 5 positions open it doesn't increase the lot size as it should, therefore it doesn't continue trading.
I need the script to do exactly what I've tried described below. I'm aware that there are different ways to open lot sizes, but i wanted to see if zorro is capable of doing it this way.
This is the code for the lot size opening:
Any help will be greatly appreciated.
Code:
function run() { StartDate = 2016; BarPeriod = 5; LookBack = 500; Hedge = 5: if (WinTotal < 0*PIP) if(NumOpenTotal < 5) { Lots = 1; } if((NumOpenTotal > 6) and (NumOpenTotal < 10)) { Lots = 2; } if((NumOpenTotal > 11) and (NumOpenTotal < 15)) { Lots = 3; } if(NumOpenTotal == 0) { if(random() < 0) enterShort(); else enterLong(); } }