Coding issue in ProBuilder Backtest

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10446 quote
    Christian
    Participant
    New

    Hello!

    I have a coding problem that i need help with. I have tried so many things and tried to read in the manual but haven’t found the answer… Im want to know how you write the code when you want to sell after a couple of days has passed. (Maybe that
    dosen´t work with PRT Backtestning???)

    Can you write something like this and put the correct function in the text?

    If x1 then
    sell 1 contract at market
    endif

    Sincerly

    Christian Nordén

    #10454 quote
    Nicolas
    Keymaster
    Master

    Hello Christian,

    If you are executing this strategy on a daily timeframe, then you can play with barindex to test the difference between the current bar number and the one of when the trade was launched.

    So if you want to sell your long trade when it’s 3 days old, you can code it like this:

    If barindex-tradeindex(1)>=3 then 
     sell at market 
    endif
    Christian thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Coding issue in ProBuilder Backtest


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Christian @otzin Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
9 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/13/2016
Status: Active
Attachments: No files
Logo Logo
Loading...