Max Loss per day

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #102882 quote
    djohnson87djohnson87
    Participant
    New

    Hi guys

    Is it possible to code a “max loss per day” into the system? Essentially adding a dollar amount loss which if hit within a period of time will stop the system trading and push into “not running”.

     

    Thanks

    #102884 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go, you’ll have to:

    • add TradeON to your conditions to enter a trade
    • set TradeON back to 1 to reenable trading whenever you want
    ONCE MaxLoss = 500
    ONCE TradeON = 1
    IF STRATEGYPROFIT <= MaxLoss THEN
       TradeON = 0
    ENDIF
    #102885 quote
    djohnson87djohnson87
    Participant
    New

    Thanks Roberto

    Bit new to this so when you say “add TradeON to your conditions to enter a trade” – is this a build in function or will this form part of the code?

    robertogozzi thanked this post
    #102886 quote
    NicolasNicolas
    Keymaster
    Legend

    A good code snippet for the daily maximum loss can be found here:

    https://www.prorealcode.com/blog/learning/max-profit-loss-day-trading-strategy/

    #102889 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Thanks Roberto

    Bit new to this so when you say “add TradeON to your conditions to enter a trade” – is this a build in function or will this form part of the code?

    You have to merge my code into yours, then us TradeON, alcong with your conditions, to enter a trade, i.e.:

    IF MyConditions AND TradeON THEN
       BUY/SELLSHORT .....
    ENDIF
    #102991 quote
    djohnson87djohnson87
    Participant
    New

    Thanks heaps Nicolas thats exactly what I needed

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

Max Loss per day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
djohnson87 @djohnson87 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by djohnson87djohnson87
7 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/19/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...