Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Inverted Martingale

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Inverted Martingale


    Can some one please help me figure out how to build a strategy that sum my position size after each won and go back to 1 if I lost.
    When the first transaction reaches the Take profit line, the following transaction opens with an additional contract automatically, but if that transaction end up being negative all resets back to the initial 1 contract.

    Example:
    Open 1 contract (if won) open the second with 2 contracts ( if won ) open the third with 3 contracts ( if lost) go back to 1 contract for the following transaction.
    (1-2-3-4-5-6-7.....) in this sequence, not doubling.


    #2
    Hello Karelgp7,

    This thread will remain open who would like to create this logic or the script as a convenience to you.

    I am happy to assist you if you would like to create this script.

    Below is a link to a forum post with helpful information about getting started with NinjaScript.
    https://ninjatrader.com/support/foru...040#post786040

    To know if the last trade is profit or loss use the SystemPerformance collection.
    https://ninjatrader.com/support/help...erformance.htm
    https://ninjatrader.com/support/help...8/currency.htm

    For example:
    if (SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1].ProfitCurrency > 0)
    {
    // trade was profitable
    }
    else if (SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1].ProfitCurrency < 0)
    {
    // trade was a loss
    }

    You can increment an integer to increase the quantity size and reset this to 0 with other criteria.
    https://ninjatrader.com/support/foru...260#post812260
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    52 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    48 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X