Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Help programmazione

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

    Help programmazione

    Ciao a tutti,
    ecco il mio problema:
    utilizzo Ninja7 (in fase di studio) con il collegamento Yahoo daily per avere dei dati storici su cui esercitarmi, non avendo quelli a minuti. Dovrei trasformare il codice seguente impostato a Tick con un'impostazione a percentuale.Quindi per esempio:

    #region Positions
    private void GoLong()
    {SetStopLoss("LongBuy", CalculationMode.Price, Close[0]-(Stop*TickSize), false);
    SetProfitTarget("LongBuy", CalculationMode.Price, Close[0]+(Fulltarget*TickSize));
    EnterLong("LongBuy");

    Ho provato da giorni ma non riesco a scrivere che invece di 30 tichs di stop deve calcolare 3% e invece di 50 ticks di fulltarget deve calcolare 5%.
    C'è qualcuno che può aiutarmi?
    Grazie.
    Ciao.

    #2
    Hello,

    Thank for your for first forum post.

    Unfortunately we only provide support in English. Can you please re submit the question in English so that I will be able to further assist.

    I look forward to assisting you further.

    Comment


      #3
      Ciao, ti traduco in inglese, qui tutto si svolge in inglese... (neanche in tedesco nonostante che qualche staff lo sia. La ditta ha la sede a Denver, Colorado in USA)
      Saluti
      Andreas


      He wants to set a stop loss of 3% and a profit target of 5%, but he is stuck with a sample for tick data only. His data feed is Yahoo daily.

      Comment


        #4
        Thanks for translating that.

        Unfortunately the Yahoo data feed only provides end of day data and the simulation engine cannot run on the yahoo data feed connection and requires a live data feed. Therefor you will be unable to use this until you connect to a data feed provider that supports live data.

        Comment


          #5
          Hello everyone,
          here is my problem:
          Ninja7 use (under study) under the link for Yahoo daily historical data on which to practice and do some back testing, failing in those minutes. Should I convert the following code set to tick with an approach to percentage.
          Example:

          # Region Positions
          private void GoLong ()
          (SetStopLoss (LongBuy "CalculationMode.Price, Close [0] - (Stop TickSize *), false);
          SetProfitTarget (LongBuy "CalculationMode.Price, Close [0] + (Fulltarget TickSize *));
          EnterLong (LongBuy ");

          I can not write that instead of 30 tichs stop must calculate 3% instead of 50 ticks of fulltarget must calculate 5%.
          Can anyone help me?
          Thank you.
          Hello.
          Roberto

          Comment


            #6
            Hello,

            There are no need for changes or overides that you need to do to be allowed to do this as this is built in already. You can change the CalculationMode to Percent when you use SetStopLoss or SetProfitTarget. Use the below as an example:

            SetProfitTarget("Long1",CalculationMode.Percent,0.01);



            Let me know if I can be of further assistance.

            Comment


              #7
              OK Brett,
              now if the position stock moves into profit by 5% (target1) port is located in a tie.
              example:
              if (High [0]> Position.AvgPrice + 5%) / / how should I write for 5% increase?
              SetStopLoss (LongBuy "CalculationMode.Percent, Position.AvgPrice, false);

              If he continues to profit , example of another 7% (TARGET2) port located on the stop target1.
              example:
              if (High [0]> Position.Avgprice +5% +7% / / as you write?
              SetStopLoss (LongBuy "CalculationMode.Percent, Position.Avgprice +5% (target1) / / as you write?
              Thank you.
              Hello.
              Roberto

              Comment


                #8
                Italy,

                There is no need to write if statements, What you would do is add these to the top of your Initilize() method and they only need to added once to the strategy, once added when you place an order long or short and it is filled the strategy will automatically submit the stop loss and profit target for you.

                5% would be written as .05

                Also no need to add Position.Avgprice +5%, just put .05 here like the example I showed you and it will put the stop .05 or 5 percent below the average entry price for you automatically.

                The below code will submit stop loss 5 percent away from your entry price automatically once you EnterLong or EnterShort.


                protected override void Initialize()
                {

                SetStopLoss(
                CalculationMode.Percent,0.05);
                }

                Let me know if I can be of further assistance.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GLFX005, Today, 03:23 AM
                0 responses
                1 view
                0 likes
                Last Post GLFX005
                by GLFX005
                 
                Started by XXtrader, Yesterday, 11:30 PM
                2 responses
                11 views
                0 likes
                Last Post XXtrader  
                Started by Waxavi, Today, 02:10 AM
                0 responses
                6 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Started by TradeForge, Today, 02:09 AM
                0 responses
                14 views
                0 likes
                Last Post TradeForge  
                Started by Waxavi, Today, 02:00 AM
                0 responses
                3 views
                0 likes
                Last Post Waxavi
                by Waxavi
                 
                Working...
                X