Need help on the code closing positions

Forums ProRealTime English forum ProOrder support Need help on the code closing positions

  • This topic has 0 replies, 1 voice, and was last updated 6 years ago by avatarrama.
Viewing 1 post (of 1 total)
  • #38000

    I am using the following code

    (after opening initial position long or strong)

     

    ****************************************

    IF longonmarket and COUNTOFPOSITION <= 100 THEN
    buy 1 perpoint at tradeprice(1)+x2 stop

    endif

    IF shortonmarket and COUNTOFPOSITION <= 100 THEN
    sellshort 1 perpoint at tradeprice(1)-x2 stop
    endif

     

     

    profitstop =.9999*tradeprice(1)
    profitstop1 =1.0001*tradeprice(1)
    if longonmarket then
    sell at profitstop stop
    endif

     

    if shortonmarket then
    exitshort at profitstop1 stop
    endif

     

    ********************

    the code is working but not efficiently the I wanted.

     

    I want to sell my all open long postions if prices goes down by 2 points( on spread betting account)

    also I want to close my shot positions when price goes by 2 points

     

    I dont see any option  in PRT for this. ALL PRT just refers candles and time of current or previous, nth previous etc.

     

    can you provide me some logic?

    I tried the follwing also

     

    if (positionperf-positionperf)<=.00012 then

    sell at market

    endif

     

Viewing 1 post (of 1 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login