Exit code

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #50935 quote
    FrankFrank
    Participant
    Junior

    Hi,

    Can someone please help me the code if I want to exit a position after X bars..?

    #50937 quote
    robertogozzirobertogozzi
    Moderator
    Legend
    IF OnMarket AND ((BarIndex - TradeIndex) >= 50) THEN
       SELL      AT MARKET   //Exit LONG  trades, if any
       EXITSHORT AT MARKET   //Exit SHORT trades, if any
    ENDIF

    This code will exit any open position after 50 bars have elapsed. You may change this number to suit your needs.

    Roberto

Viewing 2 posts - 1 through 2 (of 2 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 code


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
Frank @framul Participant
Summary

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

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 10/30/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...