Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Esignal automation......

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

    Esignal automation......

    It seems a lot has changed at Ninja since I last used it. I have the sim model now and am working on a new automation.

    My old files don't work anymore due to the changes and I was hoping someone had some basic code to post to get me started.

    What would be most helpful would be something like a simple buy or sell script based on a basic MA crossover. I don't need to do all of the cancel stuff just the checking to see if it is in a trade. Once an order is passed off to Ninja I want Ninja to handle it and avoid coding in Esignal to be changing orders, cancelling orders etc. The beauty of Ninja is that it handles orders better than anything out there and would rather use it's power than rely on Esignal generated stuff. I never need to manipulate an order beyond what Ninja can do once it has the order.

    Does anyone have a basic MA crossover script that sends the buy or sells to Ninja that they can post to save me countless hours of testing and testing? This would be a great help as I can modify it for my particular strategy but the fine points of getting the OIF created and sent are causing me problems.

    I spent about six hours on it today and have gotten nowhere.

    Regards,
    Bleemus

    #2
    imported post

    Please take a look at the eSignal sample script <install>\bin\AutoTrade\NtSample.efs.

    Unfortunately I'm not enough an EFS expert to provide a real-world MA cross oever.

    Anybody?
    DierkNinjaTrader Customer Service

    Comment


      #3
      imported post

      Thank you Dierk!

      It appears that a lot has changed by going with a .dll instead of an .oif file. Looks like I have a lot to learn to get this working.

      Checking the documentation on the site it appears that .oif is still supported. Is there any particular advantages of one over the other? I would think .oif is simpler while .dll is more powerful.

      I am not a JS programmer by any stretch and when I last used Ninja I had a friend help me with the coding. Looks like he may be busy again.

      Here is a simple EFS for a MA crossover with some ADX filtering made using the Wizard in Esignal. It is only Buy side. Just threw it together this morning in case you wanted to see it. I doubt you could make money with it!

      --------------------------

      //{{EFSWizard_Description
      //
      // This formula was generated by the Alert Wizard
      //
      //}}EFSWizard_Description


      //{{EFSWizard_Declarations
      var vSMA14_2 = new MAStudy(14, 0, "Close", MAStudy.SIMPLE);
      var vSMA28 = new MAStudy(28, 0, "Close", MAStudy.SIMPLE);
      var vADXDM = new ADXDMStudy(14);
      var vLastAlert = -1;
      //}}EFSWizard_Declarations


      function preMain() {
      /**
      * This function is called only once, before any of the bars are loaded.
      * Place any study or EFS configuration commands here.
      */
      //{{EFSWizard_PreMain
      setPriceStudy(true);
      setStudyTitle("MAcross");
      //}}EFSWizard_PreMain

      }

      function main() {
      /**
      * The main() function is called once per bar on all previous bars, once per
      * each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
      * in your preMain(), it is also called on every tick.
      */

      //{{EFSWizard_Expressions
      //{{EFSWizard_Expression_1
      if (
      vSMA14_2.getValue(MAStudy.MA) > vSMA28.getValue(MAStudy.MA) &&
      vSMA14_2.getValue(MAStudy.MA, -1) <= vSMA28.getValue(MAStudy.MA, -1) &&
      vSMA14_2.getValue(MAStudy.MA, -2) < vSMA28.getValue(MAStudy.MA, -2) &&
      vADXDM.getValue(ADXDMStudy.PDI) > vADXDM.getValue(ADXDMStudy.NDI) &&
      vADXDM.getValue(ADXDMStudy.ADX) > vADXDM.getValue(ADXDMStudy.NDI)
      ) onAction1();
      //}}EFSWizard_Expression_1

      //}}EFSWizard_Expressions


      //{{EFSWizard_Return
      return null;
      //}}EFSWizard_Return

      }

      function postMain() {
      /**
      * The postMain() function is called only once, when the EFS is no longer used for
      * the current symbol (ie, symbol change, chart closing, or application shutdown).
      */
      }

      //{{EFSWizard_Actions
      //{{EFSWizard_Action_1
      function onAction1() {
      drawTextRelative(0, low(-10), "Buy", Color.RGB(0,128,0), Color.RGB(255,255,255), Text.BOLD, "Arial", 10);
      drawShapeRelative(0, low(-5), Shape.UPARROW, "", Color.RGB(255,0,255), Shape.LEFT);
      Alert.playSound("C:\Program Files\eSignal\Sounds\YMbuy.wav");
      vLastAlert = 1;
      }
      //}}EFSWizard_Action_1

      //}}EFSWizard_Actions


      Comment


        #4
        imported post

        DLL advantages:
        - no file locking issues
        - more features supported
        - faster than OIF interface
        DierkNinjaTrader Customer Service

        Comment


          #5
          imported post

          Thanks, I will look into the .dll functions more when I return from golfing this morning and see what I can put together. I quickly patched the MA script together with the NT Sample script and it does connect to Ninja. Just have to start tweaking the code to get the orders passed along.

          Beifall und gutes Handeln!

          Comment


            #6
            imported post

            Dierk Droth wrote:
            DLL advantages:
            - no file locking issues
            - more features supported
            - faster than OIF interface

            Also, there is not additional experience required to get your EFS to work with the OIF based format or the DLL approach. It's actually likely more easy since there are a bunch of eSignal functions built that wraps the DLL.
            RayNinjaTrader Customer Service

            Comment


              #7
              imported post

              Ok, am learning it a bit. I do appreciate the help.Can anyone shed some light on the following.......

              In my script editor I get the following syntax error.....


              line 123: SyntaxError: missing formal parameter:
              function NTCommand(PLACE, Sim101, BUY, 3, MARKET, "", "", DAY, "", "", YM, "") {

              ..................................^


              Here is the code that surrounds the offending line......


              function onAction1() {
              drawTextRelative(0, low(-10), "Buy", Color.RGB(0,128,0), Color.RGB(255,255,255), Text.BOLD, "Arial", 10);
              drawShapeRelative(0, low(-5), Shape.UPARROW, "", Color.RGB(255,0,255), Shape.LEFT);
              Alert.playSound("C:\Program Files\eSignal\Sounds\YMbuy.wav");
              vLastAlert = 1;

              // Submits a NinjaTrader command.


              function NTCommand(PLACE, Sim101, BUY, 3, MARKET, "", "", DAY, "", "", YM, "") {

              return dll.call("Command", command, account, getSymbol(), action, quantity, orderType,

              limitPrice, stopPrice, timeInForce, oco, orderId, template, strategy);
              }

              Comment


                #8
                imported post

                You might want to take a look at the strategy sample: <install>\db\AutoTrade\NtSample.efs: There you'll see how to declare dll function wrappers and how to call them.
                DierkNinjaTrader Customer Service

                Comment


                  #9
                  imported post

                  Thank you Dierk. While I have sailed around the world, worked on a hedge fund trading desk, won the Doublehanded Transatlantic Race, shot 74 on a tough golf course, been scuba diving on Mellish Reef and raised two wonderful children I have yet to learn Javascript. I will keep trying or just go to Tradestation.

                  Appreciate the help.




                  Comment


                    #10
                    imported post

                    >... I have yet to learn Javascript.

                    And it will still probably be the most frustrating, confusing and infuriating thing you ever do...

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by condorhero, Yesterday, 09:28 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post condorhero  
                    Started by MaraAnkh, Yesterday, 08:44 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post MaraAnkh  
                    Started by wooofad, Yesterday, 05:38 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post wooofad
                    by wooofad
                     
                    Started by caacapital, Yesterday, 10:10 AM
                    2 responses
                    18 views
                    0 likes
                    Last Post caacapital  
                    Started by DiverG20, Yesterday, 10:23 AM
                    0 responses
                    25 views
                    0 likes
                    Last Post DiverG20  
                    Working...
                    X