Exit after 10 bars?

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

    Hi,

    How do I code an exit after 10 bars after the order?

    Thanks!

    #6459 quote
    NicolasNicolas
    Keymaster
    Legend

    Hi, with the TRADEINDEX instruction.

    Example: close all long positions if the last trade were at least 10 bars ago

    IF BARINDEX-TRADEINDEX(1) >= 10 THEN 
     SELL AT MARKET
    ENDIF
    #6478 quote
    simon_jsonsimon_json
    Participant
    Average

    Thanks!

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

Exit after 10 bars?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
simon_json @simon_json Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by simon_jsonsimon_json
10 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/04/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...