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

Convert indicator to strategy

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

  • myaha1000
    replied
    Hi , Any update on this pls?

    Leave a comment:


  • Trebor
    replied
    Hi Mestor, did you finally convert D3Spotter indicator to strategy, please?

    Leave a comment:


  • NinjaTrader_Jim
    replied
    Hello mballagan,

    Yes, it is possible to plot and use OnRender code in a strategy.

    We look forward to assisting.

    Leave a comment:


  • mballagan
    replied
    I would like to convert an indicator to a strategy. In a strategy is it possible to do graphics calculations such as normal indicator plots and also Sharp DX as in the OnRender event in an indicator?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Quantismo,

    The Strategy Builder is only able to pull from plots.

    Anything that is not a plot in an indicator cannot be selected in the Strategy Builder, though if the exposed object is public you would be able to access the object from an unlocked script that is coded by hand (outside of the Strategy Builder).

    Is there a specific plot in your script that is not appearing in the Plot drop-down when selecting this indicator in the Condition Builder of the Strategy Builder?

    I am seeing there should be 4 plots: IndicPlot0, IndicPlot1, IndicPlot2, and IndicPlot3. Are any of these plots unselectable in the Plot drop-down in the Condition Builder?

    Below I am providing a public link to a short example script that demonstrates setting a plot after detecting an action. This indicator can be used in the Strategy Builder.

    Leave a comment:


  • quantismo
    replied
    RE - Complicated Indicator

    Thanks for responding Patrick... Here is a fairly complicated custom indicator you can see If you think any of those expose methods would still work in. I marked with the green forward slashes two area's where long and short entries would make sense to expose to a strategy.

    If any of the exposed variable methods work in this indicator they would work in any indicator.

    Thanks
    Quantismo
    Attached Files

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello quantismo,

    Thank you for your post.

    I am not aware of any complexity that would prevent the sample from working as intended.

    Do you have an example of a complicated indicator that this approach does not work in?

    I look forward to your response.

    Leave a comment:


  • quantismo
    replied
    Expose a Value from more complex indicators

    I see in the 2 examples i.e.( sampleBools) and I can remember the other one, that a very simple indicator like the MACD is used to for a example in how to expose a variable in a indicator so a strategy can access it. Neither of these methods work in more complicated indicators so far as I have tried exhaustively , if anyone can show a example of one working in someone's custom random complicated indicator I would appreciate it.

    Thanks
    Quantismo

    Leave a comment:


  • NinjaTrader_PatrickH
    replied
    Hello Quantismo,

    Thank you for your post.

    You can use our example at the following link to expose indicator values that are not plots so you can access them in another indicator or strategy.
    Please let me know if you have any questions.

    Leave a comment:


  • quantismo
    replied
    code to connect draw line to a strategy?

    Its fairly easy to make a strategy from a moving average crossover utilizing a plot but some indicators draw lines that never cross anything they draw a dot, arrow , word , or something a little more complex like
    Code:
    Draw.Line(this, "low"+CurrentBar.ToString() + BarsAgo.ToString(), true, BarsAgo, Low[BarsAgo] - (TickSize * MarkerDistanceFactor), 
    									A, Low[A] - (TickSize * MarkerDistanceFactor), DivergenceColor, DivergenceDashStyle, DivergenceLineWidth);
    My question is is there a anyway to insert a generic piece of code just before any type of draw.arrow , draw.dot draw.line . into a indicator that acts as a value/signal that can be accessed when creating a strategy through strategy builder to create a buy or sell signal?
    Most likely there has to be some code in the properties area of the indicator added also, any help or tips/ links I would really appreciate/

    Thanks Quantismo

    Leave a comment:


  • Mestor
    replied
    thanks for your help

    I'm going to do tests

    Best regards

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Mestor,

    You will not be able to copy all of the contents. You would only copy the logic in OnBarUpdate and variable declaration.

    I am not able to assist from an error code. You must provide the full error message.

    Or provide a screenshot.

    (edited, I forgot to add the link)
    Below is a link to a forum post with helpful information about getting started with NinjaScript that includes a link to the NinjaScript Editor 401 video that demonstrates copying the logic and variables from one script to another.
    Last edited by NinjaTrader_ChelseaB; 06-04-2018, 12:29 PM.

    Leave a comment:


  • Mestor
    replied
    Hello,

    what I want is the second thing you are saying, but when I copy the content of the indicator to the strategy, many errors appear with the code CS0103

    I do something wrong

    The code of the indicator is the one that I have attached in my first post

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello Mestor,

    The simplest way to use the code would be to leave the indicator as an indicator and call the value from the indicator.

    But if you wanted to take the more advanced route and create a new script and copy just the logic for OnBarUpdate you could choose to do this instead.

    I was not able to confirm, what are the errors you are getting?

    What is the code in the script?

    Leave a comment:


  • Mestor
    replied
    Hello Chelsea,

    Thanks for your interest

    I do not understand much programming and what I want is simply that instead of D3Spotter being an indicator, I need it to be a strategy.

    I do not want to call the indicator from the strategy, but to be a strategy with that code.

    I tried to copy the indicator code into an empty strategy but it does not work, that's where many errors appear.

    Thank you

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Coryoodmansee, Today, 12:24 AM
0 responses
4 views
0 likes
Last Post Coryoodmansee  
Started by Zadomani, 09-08-2024, 07:45 AM
2 responses
17 views
0 likes
Last Post Zadomani  
Started by YoungCinco24, Yesterday, 09:43 PM
0 responses
8 views
0 likes
Last Post YoungCinco24  
Started by Apm123, Yesterday, 08:21 PM
0 responses
7 views
0 likes
Last Post Apm123
by Apm123
 
Started by tony_28217, 09-07-2024, 01:21 AM
2 responses
28 views
0 likes
Last Post tony_28217  
Working...
X