Stopping A System When Profit is Reached

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #206476 quote
    TobiasTobias
    Participant
    New

    Hi,

    I am new here and I am testing a few systems in forex pairs which is looking good on backtests and I am paper trading currently. For me when a system makes a certain level of expected gains I want to stop it trading. Almost like a take profit but for the system not the trade.

    So if it hits its target of say £2000 in a period then I stop the system and I essentially don’t risk it then going on to make losing trades. I would like to setup each system to trade to certain level, stop it automatically then I start it manually when I wish to.

    #206479 quote
    JSJS
    Participant
    Master

    Hi @Tobias

    You could try something with:

    If StrategyProfit >= 2000 then

    PositionSize=0

    EndIf

    The algo then continues to run but no longer places orders…

    Tobias thanked this post
    #206486 quote
    GraHalGraHal
    Participant
    Master
    Or you could use Quit
    QUIT
    JS and Tobias thanked this post
    #206535 quote
    TobiasTobias
    Participant
    New
    Thanks for this. I suppose with your approach you can also just get it to “close for the day” also. I am a programmer so I am sure I can work it out. Both this and the quit keywork are really useful though thanks. Right now my stratedgy is making money but I think my risk reward ratio is off so I am either missing out on high gains that don’t quite top out then fall or on the other side losses that are obvious “losses” and should not be waiting around for a miracle to happen.  I am new to this so will read but if you have any suggestions on this they are most welcome.
    #206543 quote
    PeterStPeterSt
    Participant
    Master
    I suppose with your approach you can also just get it to “close for the day” also.
      From another topic, from JS (no credits for me really) :  
    You say “I want to keep the codes running” but do you also want your positions to remain open outside of your trading hours? If you also want to close your positions outside your trading hours, you can use: DefParam FlatBefore=090000 DefParam FlatAfter=170000
    JS thanked this post
Viewing 5 posts - 1 through 5 (of 5 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

Stopping A System When Profit is Reached


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Tobias @shionuk Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by PeterStPeterSt
3 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/29/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...