Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Changing Background color in an Automated Trading System

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

    #16
    strategy based on color change

    Hello ChelseaB,

    I have few questions regarding building strategy in strategy wizard. I have an indicator which is changing color of the background based on the conditions.

    I tried to include it into conditions but before compiling it says: "system.drawings.color is type but it is used as variable. Is it even possible to build strategy based on changing of the color?
    If I want to change script to change variables I can not enter it and even save it to access it later.

    Second question is regarding trailing stop, trailing profit and BE. is it possible to set in stops and targets BE+1, trailing profit and trailing stop?

    Thank you

    Miroslav

    Comment


      #17
      Hello miroslav,

      In order to better assist you, would it be possible to review your code?

      To export your script do the following:
      • Click File -> Utilities -> Export NinjaScript
      • Enter a unique name for the file in the value for 'File name:'
      • Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
      • Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


      By default your exported file will be in the following location:
      • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


      Below is a link to the help guide on Exporting NinjaScripts.
      http://www.ninjatrader.com/support/h...nt7/export.htm

      If you would prefer to send your code to us privately, you can e-mail it to platformsupport[at]ninjatrader[dot]com, and reference this unique number in the body of your e-mail :

      1512601

      We will be sure to get back to you as quickly as possible.
      Jessica P.NinjaTrader Customer Service

      Comment


        #18
        Originally posted by NinjaTrader_JessicaP View Post
        Hello miroslav,

        In order to better assist you, would it be possible to review your code?

        To export your script do the following:
        • Click File -> Utilities -> Export NinjaScript
        • Enter a unique name for the file in the value for 'File name:'
        • Select the strategy from the objects list on the left -> click the right facing arrow ">" to add the strategy to the export
        • Click the 'Export' button -> click 'yes' to add any referenced indicators to the export -> click OK to clear the export location message


        By default your exported file will be in the following location:
        • (My) Documents/NinjaTrader 7/bin/Custom/ExportNinjaScript/<export_file_name.zip>


        Below is a link to the help guide on Exporting NinjaScripts.
        http://www.ninjatrader.com/support/h...nt7/export.htm

        If you would prefer to send your code to us privately, you can e-mail it to platformsupport[at]ninjatrader[dot]com, and reference this unique number in the body of your e-mail :

        1512601

        We will be sure to get back to you as quickly as possible.
        Hello JessicaP,

        please, see attached strategy. I was not able to compile since error with the background color is prevailing.

        The setting with trailing stop, BE and trailing profit is question if it is even possible. I saw possibility of trailing stop but I am more interested in BE and trailing profit for my trading purposes.

        I am also attaching files which will be necessary to open indicator which has set background change.

        Miroslav
        Attached Files

        Comment


          #19
          Hello miroslav,

          I did in fact notice a lot of syntax which needed correcting with the strategy code you sent me. The code I am returning will compile, but it will still require your in depth understanding of your indicator to get this code to work properly. You will need to look for my note which reads "none of these match your prototype" and take whatever action you feel is appropriate there.

          Summary of changes I made :

          • I commented out the extra arguments in your Indicator constructors which do not match the prototype specified in ccipokus.cs
          • Wherever you tried to call Color as though it was an array and the color name as though it was a named indice, e.g.

            Color [NavyBlue]

            I changed this to treat Color as the object it is with the color name as a named property, e.g.

            Color.NavyBlue
          • 'Time' is a Series of DateTime objects. ToTime takes a DateTime object, not a series of DateTime objects. I guessed from your code that you wanted to check the most recent time object, effectively the current time; if that assumption is incorrect you will need to modify this code as appropriate. So I changed

            Time

            to

            Time[0]

          Please review this code now that it compiles and modify it to suit your needs. Please don't hesitate to reach out to us if we can help in any way.
          Attached Files
          Last edited by NinjaTrader_JessicaP; 05-10-2016, 08:35 AM.
          Jessica P.NinjaTrader Customer Service

          Comment


            #20
            Hello Jessica P,

            thank you for your help with my strategy. Just few comments to my strategy:
            1. time issue - I wanted to say to open and close trades in specific time from 8 am to 5 pm but of my time. Btw is there some possibility to set which time period to take or it is taking windows system time?

            2. Meanwhile I was experimenting with other more solid arguments for trade and I have made some changes in my indicator script and it seems it is working. If you want I can send it to you to see what I did.

            Back to my second part of the questions from yesterday, what about BE, trailing profits etc. issues?

            One more question. I am trying to set entry by limit or stop limit orders. I set it but from strange reason it is not taking profits and closing trades with the opposite trades any suggestion? Or if I want to use this type of orders I need to set extra conditions in set sheets? Are there some more advanced tutorials to watch them?

            If I can I have one suggestion to Ninja Trader 8. When you are creating strategy it will be nice to call ATM strategies inside creating strategies in the same form as it is in chart trader or DOM.

            Comment


              #21
              Hello miroslav,

              With regard to your first question, your strategy is currently set up to only enter a long position if it is between 08:00 AM and 17:00 PM and your two indicator values match already. These are going to match up to your Windows system time.

              I won't need to see the changes to your indicator, but you will want to make sure whenever you change your indicator, your code which uses your indicator in your strategy is kept up to date.

              If you would like a trailing profit target, you will want to add a SetProfitTarget call to OnBarUpdate. I am including an excerpt from SetProfitTarget in the help guide.

              Originally posted by http://ninjatrader.com/support/helpGuides/nt7/setprofittarget.htm
              You may call this method from within the strategy OnBarUpdate() method should you wish to dynamically change the target price while in an open position
              Your SetTrailStop call in Initialize will already set a stop loss a number of ticks from break even, however, do note this excerpt from the help guide :

              Originally posted by http://ninjatrader.com/support/helpGuides/nt7/settrailstop.htm
              The SetTrailStop() method can NOT be used concurrently with the SetStopLoss() method for the same position, if both methods are called for the same position (fromEntrySignal) the SetStopLoss() will always take precedence. You can however, use both methods in the same strategy if they reference different signal names.
              As far as your suggestion, could you send a screen shot of the screens you are referring to, the way they are currently in NT8?

              To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
              Click here for instructions

              Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
              Click here for detailed instruction
              Jessica P.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by GussJ, 03-04-2020, 03:11 PM
              15 responses
              3,271 views
              0 likes
              Last Post xiinteractive  
              Started by Tim-c, Today, 02:10 PM
              1 response
              8 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by Taddypole, Today, 02:47 PM
              0 responses
              2 views
              0 likes
              Last Post Taddypole  
              Started by chbruno, 04-24-2024, 04:10 PM
              4 responses
              51 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              10 responses
              403 views
              1 like
              Last Post beobast
              by beobast
               
              Working...
              X