Averaging down/up code is not working
Forums › ProRealTime English forum › ProOrder support › Averaging down/up code is not working
- This topic has 6 replies, 3 voices, and was last updated 5 years ago by
Vonasi.
Viewing 7 posts - 1 through 7 (of 7 total)
-
-
02/26/2020 at 9:58 PM #120613code to sell 1p points1234567891011121314151617181920212223242526272829303132333435363738394041//-------------------------------------------------------------------------// Main code : buy(1)//-------------------------------------------------------------------------DEFPARAM FlatBefore = 143500DEFPARAM FlatAfter = 210000// Conditions to enter short positionsIF NOT onmarket THENsellshort 4 CONTRACTS AT MARKETENDIFnu=12nn=20222nn1=200// Conditions to exit short positionsif countofposition<=7 and countofposition>=4 thenIF longonmarket and close>tradeprice-nu THENsellshort 3 CONTRACTS AT tradeprice-nu stopendifendifif countofposition<=9 and countofposition>=7 thenIF longonmarket and close>tradeprice-nu THENsellshort 2 CONTRACTS AT tradeprice-nu stopendifendifif countofposition<=10 and countofposition>=9 thenIF longonmarket and close>tradeprice-nu THENsellshort 1 CONTRACTS AT tradeprice-nu stopendifendiffloatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsizeif onmarket and (floatingprofit <=-nn or floatingprofit >= nn1) thenexitshort at marketendif
I want to sell 10 contacts first 4 at market then 3 , 2, 1 at last trade price – nu, this code is not working for shortpostions, where the long position code is working fine where i replaced just close<tradprice+nu then, what is wrong with this code?
02/26/2020 at 9:59 PM #120614longcode which works fine1234567891011121314151617181920212223242526272829303132333435363738394041//-------------------------------------------------------------------------// Main code : buy//-------------------------------------------------------------------------DEFPARAM FlatBefore = 143500DEFPARAM FlatAfter = 210000// Conditions to enter short positionsIF NOT onmarket THENbuy 4 CONTRACTS AT MARKETENDIFnu=12nn=20222nn1=200// Conditions to exit short positionsif countofposition<=7 and countofposition>=4 thenIF longonmarket and close<tradeprice+nu THENbuy 3 CONTRACTS AT tradeprice+nu stopendifendifif countofposition<=9 and countofposition>=7 thenIF longonmarket and close<tradeprice+nu THENbuy 2 CONTRACTS AT tradeprice+nu stopendifendifif countofposition<=10 and countofposition>=9 thenIF longonmarket and close<tradeprice+nu THENbuy 1 CONTRACTS AT tradeprice+nu stopendifendiffloatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsizeif onmarket and (floatingprofit <=-nn or floatingprofit >= nn1) thensell at marketendif02/26/2020 at 10:25 PM #12061602/26/2020 at 10:31 PM #12061702/26/2020 at 10:56 PM #120618You need it as below (If shortonmarket, countofposition <= –7 etc …
not tested though
1234if countofposition<= -7 and countofposition>=-4 thenIF shortonamrket and close>tradeprice-nu THENsellshort 3 CONTRACTS AT tradeprice-nu stopendif02/26/2020 at 11:02 PM #120619Yeah it works! 🙂
CountofPosition of Shorts need a – / minus so – 4, -7 etc
1234567891011121314151617181920212223242526272829303132333435363738DEFPARAM FlatBefore = 143500DEFPARAM FlatAfter = 210000// Conditions to enter short positionsIF NOT onmarket THENsellshort 4 CONTRACTS AT MARKETENDIFnu=12nn=20222nn1=200// Conditions to exit short positionsif countofposition>= -7 and countofposition<= -4 thenIF shortonmarket and close>tradeprice-nu THENsellshort 3 CONTRACTS AT tradeprice-nu stopendifendifif countofposition>= -9 and countofposition<= -7 thenIF shortonmarket and close>tradeprice-nu THENsellshort 2 CONTRACTS AT tradeprice-nu stopendifendifif countofposition>= -10 and countofposition<= -9 thenIF shortonmarket and close>tradeprice-nu THENsellshort 1 CONTRACTS AT tradeprice-nu stopendifendiffloatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsizeif onmarket and (floatingprofit <=-nn or floatingprofit >= nn1) thenexitshort at marketendif02/26/2020 at 11:37 PM #120621 -
AuthorPosts
Viewing 7 posts - 1 through 7 (of 7 total)
Find exclusive trading pro-tools on
Similar topics: