Why does strategy open positions repeatedly?
- This topic has 5 replies, 3 voices, and was last updated 7 years ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › Why does strategy open positions repeatedly?
Tagged: CALL, POSITIONPRICE, tradeprice
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
// Definition of code parameters DEFPARAM CumulateOrders = true // Cumulating positions deactivated if time > 080800 and time < 210000 then // Conditions to enter long positions indicator2, indicator1 = CALL johne c1 = (indicator1 >= indicator2) x=6 c11 = (indicator1[1] >= indicator2[1]) c111 = (indicator1[2] >= indicator2[2]) IF c1 or c11 or c111 and not onmarket THEN BUY 1 CONTRACT AT MARKET ENDIF if longonmarket then buy 1 perpoint at POSITIONPRICE+x stop endif if shortonmarket then sellshort 1 perpoint at POSITIONPRICE-x stop endif // Conditions to enter short positions ignored, indicator3 = CALL johne indicator4, ignored = CALL johne c2 = (indicator3 CROSSES UNDER indicator4) c22 = (indicator3[1] CROSSES UNDER indicator4[1]) c222 = (indicator3[2] CROSSES UNDER indicator4[2]) IF c2 or c22 or c222 and not onmarket THEN SELLSHORT 1 CONTRACT AT MARKET ENDIF if longonmarket and c2 then sell at market endif if shortonmarket and c1 then exitshort at market endif endif set stop loss 40 set target profit 28 |
I am trying to place an order 2,3,4 at positionprice+x or -x
where as the program is just place at market at every subsequent time
say if I run the program once it is long for every 2 seconds just it adds one more
I tried even tradeprice(0)+x or -x even that is also not working
I have changed the subject title of your topic as it was meaningless.
The format for CALL is:
|
1 |
myValue1, myValue2, myValue3 = CALL "myIndicator" [parameter1,parameter2] |
See here for more info:
https://www.prorealcode.com/documentation/call/
I’m surprised that your code runs with the format that you have used.
I think that the incorrectly written CALL instruction is resulting in indicator1 and indicator2 always equalling zero and so all the entry conditions are always being met. It seems odd that the incorrectly written CALL instruction does not flag up an error.
I just tested it on my demo platform and it does:
rama – Are you sure that you have posted the correct code?
The syntax error you have is normal because you don’t have this file into your platform.
It is possible to use CALL like the way @rama did. Because there are no settings and the indicator name doesn’t have special characters.
because you don’t have this file into your platform.
Of course – how stupid of me. Not enough cups of tea yet and trying to do five things at once are my excuses!
Find exclusive trading pro-tools on 