Add position if in profit

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #186914 quote
    UkDownUnderUkDownUnder
    Participant
    Average

    H, I’m looking for some prompts on….

    Add position if in profit

    or

    Add position if point size is > than 15

     

    with Regards, Thanks

    #186925 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go

    N = 0    //or 15 or any treshold you prefer
    ProfitPips = PositionPrice * PositionPerf / PipSize
    If ProfitPips > N then
       If LongOnMarket then
          Buy 1 contract at Market
       Elsif ShortOnMarket then
          Sellshort 1 contract at Market
       Endif
    Endif
    UkDownUnder thanked this post
    #186933 quote
    NicolasNicolas
    Keymaster
    Legend

    You can check positionperf for a positive order (in profit):

    if positionperf(0) > 0 then 
     buy at market 
    endif

    or a distance in points:

    if close - tradeprice > 15 * pointsize then 
     buy at market 
    endif
    UkDownUnder thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Add position if in profit


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
UkDownUnder @jamescoop Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by NicolasNicolas
4 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/29/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...