continues to buy after a Stopploss

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

    Hello. when I’m long and mine makes a stoploss, it continues to buy after it makes a stoploss when a new bar comes. I want it not to buy until it receives a new signal that it will go short. it’s the same when I’m short and want it not to buy again until I’m long stoploss 50 pips

    #225997 quote
    GraHalGraHal
    Participant
    Master

    Are you using below at the beginning of your code?

    Defparam CumulateOrders = False

    When set to false, prohibits a code from reinforcing positions and setting multiple orders to enter the market in the same direction.

    kvacksa87 thanked this post
    #225998 quote
    kvacksa87kvacksa87
    Participant
    Junior

    thanks for quick reply . I’ll see if I have that code set to false, otherwise I’ll write again

    #225999 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    This one will always enter alternate trades:

    DEFPARAM CumulateOrders= false
    ONCE Flag = 0     //1=last trade was LONG,  -1=last trade was SHORT
    Bull3 = summation[3](close > open) = 3
    Bear3 = summation[3](close < open) = 3
    LongConditions  = close CROSSES OVER  average[20,0](close) AND Bull3 AND Not LongOnMarket
    ShortConditions = close CROSSES UNDER average[20,0](close) AND Bear3 AND Not ShortOnMarket
    IF LongConditions AND Flag <> 1 THEN
       BUY 1 CONTRACT AT MARKET
       Flag = 1
       SET TARGET pPROFIT 200
       SET STOP   pLOSS   100
    ENDIF
    IF ShortConditions AND Flag <> -1 THEN
       SELLSHORT 1 CONTRACT AT MARKET
       Flag = -1
       SET TARGET pPROFIT 200
       SET STOP   pLOSS   100
    ENDIF
    kvacksa87 thanked this post
    #226011 quote
    kvacksa87kvacksa87
    Participant
    Junior

    thank you so much robertogozzi for great ideas as usual 😉

    robertogozzi 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

continues to buy after a Stopploss


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kvacksa87 @kvacksa87 Participant
Summary

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

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