The next day trade if it gets 3 stoplosses in a row

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #226878 quote
    kvacksa87kvacksa87
    Participant
    Junior

    Hello. is there a code that makes it not place any more orders if it makes 3 losing trades in a row through stop loss on the same day. I want it to start again after the next day.

    #226905 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    There you go:

    ONCE TradeON = 1
    ONCE SLtally = 0
    ONCE SLhit   = 0
    IF IntraDayBarIndex = 0 THEN
       TradeON = 1
       SLtally = 0
       SLhit   = 0
    ENDIF
    // check if a trade was profitable or not, then stop trading after 3 consecutive losses
    IF StrategyProfit > StrategyProfit[1] THEN
       SLhit   = 0
       SLtally = 0
       TradeON = 1
    ELSIF StrategyProfit < StrategyProfit[1] THEN
       SLhit = SLhit + 1
       IF SLhit = 3 THEN
          TradeON = 0
       ENDIF
    ENDIF
    Sma               = average[20,0](close)
    MyLongConditions  = Not OnMarket AND close CROSSES OVER  Sma AND TradeON
    MyShortConditions = Not OnMarket AND close CROSSES UNDER Sma AND TradeON
    IF MyLongConditions THEN
    BUY 1 CONTRACT AT MARKET
    ELSIF MyShortConditions THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    SET STOP   pLOSS   10
    SET TARGET pPROFIT 20
    //graph SLhit
    //graph TradeON coloured("Red")
    #226916 quote
    kvacksa87kvacksa87
    Participant
    Junior

    Thanks for the quick response as usual

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

The next day trade if it gets 3 stoplosses in a row


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kvacksa87 @kvacksa87 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by kvacksa87kvacksa87
2 years, 7 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/24/2024
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...