code for profit or loss

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

    hi,

    is there code/s to tell if a position is in profit or loss?

    thank you

    #161254 quote
    VonasiVonasi
    Moderator
    Master
    if longonmarket and close > positionprice then
    
    //or
    
    if shortonmarket and close < positionprice then
    

    Obviously you will have to wait for the first candle to close before knowing whether you are in profit or not.

    Midlanddave thanked this post
    #161315 quote
    NicolasNicolas
    Keymaster
    Legend

    or POSITIONPERF that gives you the performance of the current position in percentage of price.

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

code for profit or loss


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kevin12345 @kevin12345 Participant
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by NicolasNicolas
5 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/13/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...