• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 faisamtrader, Today, 10:31 AM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_Tyler  
    Started by ChazJ, Today, 09:48 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by maxie, Today, 10:01 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Melissa  
    Started by Bionian, Today, 09:36 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by tomd, Today, 09:48 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Ariana  
    Working...
    X