Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Compiler errors

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

    Compiler errors

    I am testing a different version of my LinReg crossover strategy. It is a version that I have used in TradeStation.

    Instead of using crossovers, I am using > and <.

    Although these may appear to be too indefinite, they can be executed only when the position is as stated (Long, Short or Flat).

    For example:

    For // Condition set 1
    if (Position.MarketPosition == MarketPosition.Short
    && (LinReg(Close, fast) > (LinReg(Close, slow)[0] + aBuff)))
    {
    ExitShort(n, "CS.LRS");
    }

    I am getting the following compiler errors:
    The name ‘MarketPositionShort’ does not exist in the current context CS0103
    The name ‘PositonMarketPosition’ does not exist in the current context CS0103
    Operator > cannot be applied to operands of type ‘NinjaTrader.Indicator.LinReg’
    and ‘double’. CS0019


    For // Condition set 7
    if(Position.GetProfitLoss(Close[0],PerformanceUnit.Currency) > Mn)
    {
    SetTrailStop ("SS.LRS" , CalculationMode.Price, STS, true);
    SetTrailStop ("B.LRS" , CalculationMode.Price, STS, true);
    }

    I am getting the following compiler error:
    The name ‘PerformanceUnitCurrency’ does not exist in the current context CS103


    How can I correct these errors?

    #2
    Skat100, for the first condition please compare a double to a double, so use LinReg(Close, fast)[0]

    For the other errors you list, I can't see a reason other than probably formatting.

    If you attach the code as cs or zip file this is easier for us to check for you, thanks!
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Don't understand your reply.

      Please compare a double to a double. Looking at my code in previous post please tell me just what that means. What double??

      The errors that say a phrase does not exist in the current context (CS103) must have a specific meaning. But I don't get it. Please explain.

      Thanks for all the rapid responsed. I really appreciate the help.

      Stan

      Comment


        #4
        skat100, I would suggest you check into this link for the basic syntax in NinjaScript and variable type explanations - http://www.ninjatrader-support.com/H...sicSyntax.html

        In your code you try to compare a dataseries to a double value, this will not work and the compiler noted it. If you compare a double element of the dataseries (by adding for example [0] to it) you can compare it to your double value then.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Request for call.

          Berttrand,

          I certainly appreciate all the time you have spent with me. I believe I am just a couple issues away from going sim and then live.

          Would you please call me and get me squared away on these few errors. I have read your help responses but still need help. This is not your fault. I am just not getting the meaning clearly enough to correct the errors.

          The export function does not permit me to export a document that contains compile errors. However, I previously sent you a word document containing my strategy. Perhaps you can use that.

          Thanks, again.
          Stan

          Comment


            #6
            Stan, you're welcome - I'll contact you then via email to follow up.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Request for call

              Bertrand,

              I hope you will be able to spare a few moments on the phone today to help me clear up the last two obstacles to my being able to trade my system:

              1-Trailing stop doesn't appear to be operating.

              2-The issue you raised about comparing DataSeries and double. I believe the problem is that the following cross should be between a double and a double but instead is between a DataSeries and a DataSeries. I confess I do not understand how to code this and would appreciate it if you would modify the code to be correct. The intent is to establish a comparison between two DataSeries double values.

              When I look at the code below, I see two double values, not two DataSeries and not one double and one DataSeries:


              && CrossAbove(LinReg(Close[
              0], fast), (LinReg(Close[0], slow) + aBuff), 1))

              I would greatly appreciate a call (860/434-9609) to get me to be able to trade this afternoon or Monday morning.

              Stan

              Comment


                #8
                Stan, thanks for sending over the code yesterday - as I compared entries to TradeStation your code appeared correct as without the buffer values similiar entries were generated. So I would suggest to check into different values for those, as they appear to be too hard to trigger the amount of trades you seek. Your trailing stop in the code is set to price value of 50 which will not generated a valid trail stop order, please try for example the tick calculation mode with a setting of 5 for a full 100K forex lot (which would mimic your 50$ one in TradeStation). I'll contact you directly via email for the call.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  Compiler Errors

                  Thanks for all your help.

                  Where do I change the calculation mode to ticks for the trailing stop. In the form for entering input variables, all are either int or dollars. How do I distinguish ticks for my Mn input (min profit level before trailing stop can kick in) and for STS (the amount of the trailing stop give back)?. I'm surprised these values cannot be dollars?

                  The DataSeries versus double conflict you identified still exists and with all the back and forth between us, I just don't know how to cope with it. Would you please change the following code to make it correct? Perhaps then I will understand.

                  if (Position.MarketPosition == MarketPosition.Flat
                  && CrossAbove(LinReg(Close[
                  0], fast), (LinReg(Close[0], slow) + aBuff), 1))

                  Thanks.
                  Stan

                  Comment


                    #10
                    Chart Data

                    When I open a chart, the most recent data is June 22 instead of June 26. I have downloaded Historical Data and my data connection to TradeStation is working.

                    How do I correct this?

                    Thanks.
                    Stan

                    Comment


                      #11
                      Stan,

                      1. Please right click in the chart and select 'Format Data Series', then check which data you have entered as 'Last Data' > make sure this is set to today then 26th.

                      2. For the trailing stop you can call it for example with -

                      Code:
                       
                      SetTrailStop("YourEntry", CalculationMode.Ticks, 5, false);


                      The input value in this mode is ticks, so for your Forex standard lot this would 1 pip = 10$.

                      3. The LinrReg indicator takes a data series input, so you don't need to specify doubles with the brackets [ ]. To add the buffer later to your LinReg value you would then need to reference a specific double from the data series it returns, to make the addition of your buffer value possible.

                      Code:
                       
                      if (Position.MarketPosition == MarketPosition.Flat && CrossAbove(LinReg(Close, 2), (LinReg(Close, 4)[0] + 0.5), 1))
                      EnterLong();
                      Maybe this sample is helpful - http://www.ninjatrader-support2.com/...ead.php?t=7299
                      BertrandNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Christopher_R, Today, 12:29 AM
                      0 responses
                      7 views
                      0 likes
                      Last Post Christopher_R  
                      Started by sidlercom80, 10-28-2023, 08:49 AM
                      166 responses
                      2,235 views
                      0 likes
                      Last Post sidlercom80  
                      Started by thread, Yesterday, 11:58 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post thread
                      by thread
                       
                      Started by jclose, Yesterday, 09:37 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post jclose
                      by jclose
                       
                      Started by WeyldFalcon, 08-07-2020, 06:13 AM
                      10 responses
                      1,415 views
                      0 likes
                      Last Post Traderontheroad  
                      Working...
                      X