Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Martingale Strategy in Strategy Builder
Collapse
X
-
Martingale Strategy in Strategy Builder
Anyone have any idea how to create a martingale strategy in the strategy builder?Tags: None
-
Hello tradersgrail,
Thank you for your post.
From my understanding, a martingale strategy has to do with a strategy that has you double your position after a losing trade. This may be difficult in the strategy builder, but depending on the logic you use may be a possibility. It would almost certainly be easier to do by unlocking the code and actually programming the strategy directly using NinjaScript.
If you know the logic you would like and can write this as psuedo code in plain English, we can assist you in writing this as logic in C#. This thread will also remain open for any community members that know of an existing strategy with this functionality or who would like to create this as a convenience to you.
I'm providing a link to a pre-recorded set of videos 'Strategy Builder 301' and 'NinjaScript Editor 401' for you to view at your own convenience.
Strategy Builder 301
NinjaScript Editor 401
If you would like to take on learning NinjaScript, we have a fully documented help guide which will help you get started. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.
A link to our Help Guide can be found below: https://ninjatrader.com/support/help...injascript.htm
I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript: https://ninjatrader.com/support/help..._resources.htm
You will find Reference Samples online as well as some Tips and Tricks for both indicators and strategies:
Click here to see our NinjaScript Reference Samples: https://ninjatrader.com/support/help...ce_samples.htm
Click here to see our NinjaScript Tips: https://ninjatrader.com/support/help...en-us/tips.htm
These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.
There is also a growing library of user submitted custom indicators (100+) that can be downloaded from the NinjaTrader Ecosystem User App Share page: https://ninjatraderecosystem.com/user-app-share/ However, a cursory search did not find an existing Martingale strategy available.
Please let us know if we may be of further assistance to you.
The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
-
i am trying to add a martingale class to a strategy that i built using strategy builder, but getting errors when trying to run it .( cannotOriginally posted by NinjaTrader_Kate View PostHello tradersgrail,
Thank you for your post.
From my understanding, a martingale strategy has to do with a strategy that has you double your position after a losing trade. This may be difficult in the strategy builder, but depending on the logic you use may be a possibility. It would almost certainly be easier to do by unlocking the code and actually programming the strategy directly using NinjaScript.
If you know the logic you would like and can write this as psuedo code in plain English, we can assist you in writing this as logic in C#. This thread will also remain open for any community members that know of an existing strategy with this functionality or who would like to create this as a convenience to you.
I'm providing a link to a pre-recorded set of videos 'Strategy Builder 301' and 'NinjaScript Editor 401' for you to view at your own convenience.
Strategy Builder 301
NinjaScript Editor 401
If you would like to take on learning NinjaScript, we have a fully documented help guide which will help you get started. You will find language references to all of the methods and functions you will be using. You will also see a tutorial section which will help you create your first indicator and get you started with some of these concepts.
A link to our Help Guide can be found below: https://ninjatrader.com/support/help...injascript.htm
I am also linking you to the Educational Resources section of the Help Guide to help you get started with NinjaScript: https://ninjatrader.com/support/help..._resources.htm
You will find Reference Samples online as well as some Tips and Tricks for both indicators and strategies:
Click here to see our NinjaScript Reference Samples: https://ninjatrader.com/support/help...ce_samples.htm
Click here to see our NinjaScript Tips: https://ninjatrader.com/support/help...en-us/tips.htm
These samples can be downloaded, installed and modified from NinjaTrader and hopefully serve as a good base for your custom works.
There is also a growing library of user submitted custom indicators (100+) that can be downloaded from the NinjaTrader Ecosystem User App Share page: https://ninjatraderecosystem.com/user-app-share/ However, a cursory search did not find an existing Martingale strategy available.
Please let us know if we may be of further assistance to you.
The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.
looks like i cannot attach the code to this message . please let me know how todo that .
thanks for your help and support
Comment
-
Hello abdelkrikib,
Thank you for your reply.
Looks like an error is being hit within the OnStateChange() method of the strategy. If the Strategy is still editable in the Strategy Builder, you can click the View Code and copy what you've currently got in OnStateChange() and then paste the text of that in your reply. If you've already unlocked it, you can copy and paste from the NinjaScript Editor, but I'd like to see if there's something obvious you've got in that method that would throw an error.
Thanks in advance; I look forward to assisting you further.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
54 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
131 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
73 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
44 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|

Comment