Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Convert indicator to strategy

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

  • 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.
    https://ninjatrader.com/support/foru...725#post529725

    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.
    http://ninjatrader.com/support/forum...609#post503609
    Last edited by NinjaTrader_ChelseaB; 06-04-2018, 11:29 AM.

    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:


  • NinjaTrader_ChelseaB
    replied
    Hello Mestor,

    What are the errors you are getting?

    Was the code in your script?

    To confirm, you have started a new NinjaScript Strategy and you are calling the indicator from your strategy, is this correct?

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by POTTER16, Today, 03:31 PM
0 responses
4 views
0 likes
Last Post POTTER16  
Started by enricbcn, 05-08-2018, 01:36 AM
78 responses
43,511 views
1 like
Last Post Wessel
by Wessel
 
Started by Wessel, Today, 12:50 PM
0 responses
8 views
0 likes
Last Post Wessel
by Wessel
 
Started by asmmbillah, Today, 12:39 PM
0 responses
8 views
0 likes
Last Post asmmbillah  
Started by dtmtradingco, Today, 12:30 PM
0 responses
7 views
0 likes
Last Post dtmtradingco  
Working...
X