Increase position when trailing stop loss moves

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

    Hi All

    I am reaching out for some help on coding, I want to find a way of doubling down on my position when the trailing stop loss is greater than open.

    I had a go at using pips, ie when market price is X pips above entry then open new position, but not had much luck getting this to work.

    Ideally I want the Stop loss to drive the entry and possibly be able to add a further condition.

    ie

    When my TSL is greater than market entry price by X then open new market position.

    Max positions 2

     

    thanks for your help.

     

    Tom

    #208047 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    That’s an example:

    DEFPARAM CumulateOrders = true
    // .
    // .         this is where your code is (no matter how many lines it takes)
    // .
    IF PositionPerf > 0 THEN
       BUY 1 CONTRACT AT MARKET   //or SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    // .
    // .         you can write additional code here
    // .

    you may want to add some limit to the number of additional contracts to be traded (3 in this example):

    IF (PositionPerf > 0) AND (abs(CountOfPosition) < 3) THEN
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

Increase position when trailing stop loss moves


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
Mopefish @mopefish Participant
Summary

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

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 01/23/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...