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 NinjaTrader_PatrickG, Yesterday, 03:46 PM
    1 response
    10 views
    0 likes
    Last Post Maverick  
    Started by nordseven, 02-24-2017, 02:14 AM
    4 responses
    2,289 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Sorcerysoft, 08-11-2020, 10:32 PM
    0 responses
    4 views
    0 likes
    Last Post Sorcerysoft  
    Started by DaveCro, 08-11-2020, 09:05 PM
    0 responses
    20 views
    0 likes
    Last Post DaveCro
    by DaveCro
     
    Started by magnatauren, 08-11-2020, 08:26 PM
    0 responses
    7 views
    0 likes
    Last Post magnatauren  
    Working...
    X