code for profit or loss

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

    hi,

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

    thank you

    #161254 quote
    Vonasi
    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
    Nicolas
    Keymaster
    Master

    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.

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 Nicolas
5 years ago.

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