Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

a code to start with

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

    a code to start with

    Hi, I am new here, if I want to chage the code below to Ninja strategy, what will it be? Thank you very much.

    inputs: MA1(10), MA2(60),MA3(200);
    variables: var1( 0 ), var2( 0 ), var3( 0 );
    var1 = AverageFC( c, MA1 ) ;
    var2 = AverageFC( c, MA2 ) ;
    var3 = AverageFC( c, MA3 ) ;

    condition1 = var1 > var2 ;
    condition2 = var1 < var2 ;
    condition3 = var2 > var3;
    condition4 = var2 < var3;
    if condition1 and condition3 then buy next bar at market ;
    if condition2 and condition4 then sellshort next bar at market ;​

    #2
    Hi, I am new here, if I want to chage the code below to Ninja strategy, what will it be? Thank you very much.

    inputs: MA1(10), MA2(60),MA3(200);
    variables: var1( 0 ), var2( 0 ), var3( 0 );
    var1 = AverageFC( c, MA1 ) ;
    var2 = AverageFC( c, MA2 ) ;
    var3 = AverageFC( c, MA3 ) ;

    condition1 = var1 > var2 ;
    condition2 = var1 < var2 ;
    condition3 = var2 > var3;
    condition4 = var2 < var3;
    if condition1 and condition3 then buy next bar at market ;
    if condition2 and condition4 then sellshort next bar at market ;

    Comment


      #3
      Hello dragonkevin,

      It looks like this is code for a different platform so that would not be something you can just make into a strategy in NinjaTrader, you would have to use NinjaScript (C# language) to remake what that code does in NinjaTrader.

      I would suggest taking a look at some of the existing NinjaScript content like indicators and strategies that come with the platform as a starting point. Once you are comfortable using NinjaScript you could start looking at how to convert that code. You would need to review what each of the items you posted does in the other platform for example what the AverageFC does and then try to match that with a NinjaScript feature or use math/logic to recreate that feature.

      There are some educational references in the following link that can help with learning NinjaScript. https://ninjatrader.com/support/help..._resources.htm

      You can find a video that goes over creating a strategy and running it in the following link. That would also be a good place to learn about using inputs and variables. https://youtu.be/VxU4FR6GWNA

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      64 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      139 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      75 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      50 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X