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

CCI with audible alert at +100 and -100

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

    CCI with audible alert at +100 and -100

    I would like to add the code for this alert to sound on CCI at +100 and -100
    Thanks

    #2
    I dropped an alert from another indicator into cci but it has errors that I don't understand


    <?xml version="1.0"?>

    -<NinjaTrader>

    <Version>7.0.1000.39</Version>

    <ClassName>NinjaTrader.Indicator.CCI</ClassName>


    -<Default>


    -<CCI xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <AllowRemovalOfDrawObjects>false</AllowRemovalOfDrawObjects>

    <AutoScale>true</AutoScale>


    -<BarsPeriods>


    -<Period>

    <BasePeriodType>Minute</BasePeriodType>

    <BasePeriodValue>1</BasePeriodValue>

    <Id>Final2</Id>

    <MarketDataType>Last</MarketDataType>

    <PointAndFigurePriceType>Close</PointAndFigurePriceType>

    <ReversalType>Tick</ReversalType>

    <Value>5</Value>

    <Value2>1</Value2>

    </Period>

    </BarsPeriods>

    <CalculateOnBarClose>true</CalculateOnBarClose>

    <DisableScaleBuffer>false</DisableScaleBuffer>

    <Displacement>0</Displacement>

    <DisplayInDataBox>true</DisplayInDataBox>

    <DrawOnPricePanel>true</DrawOnPricePanel>

    <Enabled>false</Enabled>

    <ForceMaximumBarsLookBack256>false</ForceMaximumBarsLookBack256>

    <HorizontalGridLines>true</HorizontalGridLines>

    <InstrumentsSerializable>CL 11-18 Nymex</InstrumentsSerializable>


    -<Lines>


    -<Line>

    <Name>Level 2</Name>


    -<PenSerializable>

    <Color>narkGray</Color>

    <DashStyle>Solid</DashStyle>

    <Width>1</Width>

    </PenSerializable>

    <Value>200</Value>

    </Line>


    -<Line>

    <Name>Level 1</Name>


    -<PenSerializable>

    <Color>n:Red</Color>

    <DashStyle>Solid</DashStyle>

    <Width>4</Width>

    </PenSerializable>

    <Value>100</Value>

    </Line>


    -<Line>

    <Name>Zero line</Name>


    -<PenSerializable>

    <Color>n:White</Color>

    <DashStyle>Dash</DashStyle>

    <Width>2</Width>

    </PenSerializable>

    <Value>0</Value>

    </Line>


    -<Line>

    <Name>Level -1</Name>


    -<PenSerializable>

    <Color>n:Lime</Color>

    <DashStyle>Solid</DashStyle>

    <Width>4</Width>

    </PenSerializable>

    <Value>-100</Value>

    </Line>


    -<Line>

    <Name>Level -2</Name>


    -<PenSerializable>

    <Color>narkGray</Color>

    <DashStyle>Solid</DashStyle>

    <Width>1</Width>

    </PenSerializable>

    <Value>-200</Value>

    </Line>

    </Lines>

    <LinesConfigurable>true</LinesConfigurable>

    <MaximumBarsLookBack>TwoHundredFiftySix</MaximumBarsLookBack>

    <Name/>

    <Overlay>false</Overlay>

    <PaintPriceMarkers>true</PaintPriceMarkers>

    <Panel>1</Panel>

    <PanelUI>2</PanelUI>


    -<Plots>


    -<Plot>

    <Max>1.7976931348623157E+308</Max>

    <Min>-1.7976931348623157E+308</Min>

    <Name>CCI</Name>


    -<PenSerializable>

    <Color>n:White</Color>

    <DashStyle>Solid</DashStyle>

    <Width>2</Width>

    </PenSerializable>

    <PlotStyle>Line</PlotStyle>

    </Plot>

    </Plots>

    <PlotsConfigurable>true</PlotsConfigurable>

    <ScaleJustification>Right</ScaleJustification>

    <SelectedSeries>0</SelectedSeries>

    <SessionBreakLines>true</SessionBreakLines>

    <VerticalGridLines>true</VerticalGridLines>

    <ZOrder>30013</ZOrder>

    <Period>14</Period>


    </Plots>

    <PlotsConfigurable>true</PlotsConfigurable>

    <ScaleJustification>Right</ScaleJustification>

    <SelectedSeries>0</SelectedSeries>

    <SessionBreakLines>true</SessionBreakLines>

    <VerticalGridLines>true</VerticalGridLines>

    <ZOrder>30035</ZOrder>

    <dataBoxOffset>12</dataBoxOffset>

    <dataBox_colWidthFactor>5</dataBox_colWidthFactor>

    <ShowDvgOnly>true</ShowDvgOnly>

    <ShowPotential>true</ShowPotential>

    <ShowText>true</ShowText>

    <TextColorSerialize>n:Yellow</TextColorSerialize>

    <PlotDivergencePivots>true</PlotDivergencePivots>

    <Fib_Timeframes>10</Fib_Timeframes>

    <Fib_AutoFluSetting>22</Fib_AutoFluSetting>

    <Fib_NdaysBack>365</Fib_NdaysBack>

    <Fib_UpdatePeriod>240</Fib_UpdatePeriod>

    <tickOffset>4</tickOffset>

    <EnableAlerts>true</EnableAlerts>

    <textColorSerialize>n:Yellow</textColorSerialize>


    -<alertFontSerialize>

    <FontFamily>Tahoma</FontFamily>

    <Size>10</Size>

    <Style>Bold</Style>

    </alertFontSerialize>

    <ShowArrows>true</ShowArrows>

    <SoundFileName>142 AREA.WAV</SoundFileName>


    </CCI>

    </Default>

    </NinjaTrader>

    Comment


      #3
      Hello mando,

      Thank you for the post.

      I wanted to clarify what you are asking.

      The code you provided seems to be a template. Are you saying this was part of the error you had seen when doing the action you described?


      You asked:
      I would like to add the code for this alert to sound on CCI at +100 and -100
      Are you asking how to create an indicator, and what syntax would be needed to create an alert for the CCI?



      I look forward to being of further assistance.

      JesseNinjaTrader Customer Service

      Comment


        #4
        I used the NT7 cci code and tried to drop in an alert code from another indicator with the intent of having a cci that alerts at 100 and -100. dropping in that alert code has errors that I don't understand.
        so I either want to modify the current code or create a new one, whichever is easier
        Last edited by mando; 10-09-2018, 12:34 PM.

        Comment


          #5
          Hello mando,

          Thank you for the reply.

          In this case, if you are trying to mix indicators, that can result in errors if the incorrect syntax was used. Can you tell me what portion of the other indicators code were you trying to copy over?

          The syntax for making an alert is only 1 line which you can find an example of here: https://ninjatrader.com/support/help...lightsub=alert

          Were you trying to copy over more than just the alert such as conditions? The template you provided is not syntax so that specifically cannot be used in combination with the CCI indicator to create an alert.

          It is most likely easiest to make a new indicator if you are trying to make an alert based off of another indicator. For example, if you wanted alerts based on the CCI, it would be easiest to make a new indicator for that purpose.

          In a new indicator, you can reference the CCI like the following:

          Code:
          double value = CCI(20)[0];
          Print("The current CCI value is " + value.ToString());
          
          which could then be used in a condition: 
          
          if(value >= 100)
          {
             // send an alert
          }
          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment


            #6
            this is what I copied over from another oscillator into cci code

            <tickOffset>4</tickOffset>

            <EnableAlerts>true</EnableAlerts>

            <textColorSerialize>n:Yellow</textColorSerialize>


            -<alertFontSerialize>

            <FontFamily>Tahoma</FontFamily>

            <Size>10</Size>

            <Style>Bold</Style>

            </alertFontSerialize>

            <ShowArrows>true</ShowArrows>

            <SoundFileName>142 AREA.WAV</SoundFileName>

            Comment


              #7
              Hello mando,

              Yes, this is not NinjaScript syntax and could not be combined with an existing indicator. This is part of a template the platform uses for the general user interface such as storing settings.

              NinajScript is C# code which is like the sample I provided in the last post. Are you wanting to develop an indicator that can create alerts in an automated way, or are you looking for a general way to create alerts when you want them? You can configure this type of alert using the charts right click -> Alerts menu. If you wanted to make an indicator, that would require some manual coding.

              When you apply indicators to a chart, you can use the Right click -> Alerts menu to configure basic conditions such as if the CCI is greater than a value. If you need to do that only once, making a chart alert is likely easiest. If you want to replicate this over many charts, an indicator is likely the best choice.

              I look forward to being of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Thanks Jesse, I need to find someone who can code it then

                Comment


                  #9
                  mando if you need help just contact me

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by BarzTrading, Today, 07:25 AM
                  2 responses
                  15 views
                  1 like
                  Last Post BarzTrading  
                  Started by devatechnologies, 04-14-2024, 02:58 PM
                  3 responses
                  20 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by tkaboris, Today, 08:01 AM
                  0 responses
                  4 views
                  0 likes
                  Last Post tkaboris  
                  Started by EB Worx, 04-04-2023, 02:34 AM
                  7 responses
                  162 views
                  0 likes
                  Last Post VFI26
                  by VFI26
                   
                  Started by Mizzouman1, Today, 07:35 AM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Working...
                  X