Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Super Trend For Ninja Trader Needed

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

  • luxurious_04
    replied
    Someone help me on accessing the value of the Elliott Wave's TSSuperTrend in a strategy? I keep on getting an error on it.

    Leave a comment:


  • birdog
    replied
    Hi...where can I download the latest and most original version?

    Leave a comment:


  • philip01
    replied
    within the day

    it is possible, that the indicator calculate only intraday "within the day"? Start every day with new fresh data, dont look yesterday prices?

    thanks in advance.

    Leave a comment:


  • marcow
    replied
    What is doing now is if the red SuperTrend line is below 50 SMA it will wait until last price is above 50 SMA and fires off a trade when it shouldn't
    the code in the SuperTrendDemoSMA you posted says:

    When condition 1 and 2 and 3 are met go long.
    condition 1) SuperTrend indicator was short
    condition 2) price crosses above DownTrend[0] (red line)
    condition 3) price greater then SMA(50)

    you made an error in the 3rd condition. You want the supertrend RED line to be above SMA(50), not the price ! So condition 3 should be:
    condition 3) DownTrend[0] greater then SMA(50)

    take a look at the code in the attached strategy. Here it says SMA(50) < Supertrend red line, but that is the same. It should work now.

    Also is there a site that you know of that would be like a dictionary for code so that I can start to make sense of this
    What I find the most helpful is to use the Strategy Builder/Wizard in NinjaTrader.
    Don't know if you used it before, you can find it at NTcontrolPanel/Tools/newNinjascript/Strategy. Then create a very simple strategy like if Close[0] > MA(25) and press the view code button.Now you see the actual code of the strategy. Now change some parameters of the strategy in the Wizard building blocks and see the code getting updated realtime ! Try to understand what changed in the code and why it changed.

    The NinjaTrader Help file also contains lots of code examples. Take a look at NinjaScrip/Educational Resources/Basic Programming Concepts.
    Attached Files

    Leave a comment:


  • geotabs
    replied
    Hi Marco

    It works like a charm, I'm still trying to figure what the code means but works great.
    Thanks Again
    I have been tinkering with your Supertrenddemo to add a second filter, what I was trying to do is to only have a long trade fire off if red SuperTrend line is above 50 SMA, if red SuperTrend line is below 50 SMA it will not fire off a trade and the opposite for short.
    What is doing now is if the red SuperTrend line is below 50 SMA it will wait until last price is above 50 SMA and fires off a trade when it shouldn't

    I have attached a pic also with cs file

    PS
    Also is there a site that you know of that would be like a dictionary for code so that I can start to make sense of this :
    Attached Files

    Leave a comment:


  • marcow
    replied
    hello geotabs,

    I don't know very much about ATM strategies as I said before. After looking at the ATM strategy you posted I was curious of how these ATM stragties exactly worked, and started experimenting why it wasn'r working as expected.

    The problem in the ATM strategy is that it starts a new ATMstrategy over and over, because the segment in the code where the ATMStratgeyCreate is located is executed every tick if Price is above/below the green/red line. The condition is not a crossover anymore (as it was in the original SuperTrend demo) which is only executed once.
    The trick is to create boolean which you set once you've executed the ATMStratgeyCreate command , so it only gets executed once. Another thing to do is to close out any running ATMstrategies before starting a new one.
    I've also introduced a integer named "count" which advances the ATMStrategyID name with 1 for each new ATMstategy created. This way you have a "logical" new name for each ATMstrategy and not a random value as the "GetATMStartegyUniqueID" generates.

    I've attached your strategy with these changes, feel free to study the code and see how things are done. I've commented most added code for clarification.

    By the way, in my opinion you're making good progress in your programming skills.

    let me know if the strategy works.

    Marco
    Attached Files

    Leave a comment:


  • geotabs
    replied
    I have made a new strategy with an ATM strategy for order entry, It does fill but it continues to submit orders and fills them, I have set entries per direction to 1 and tried changing entry handling to unique entry but still fires off order after order.
    I am new to programming and have attached what I have done, if anyone here could explain where I'm going wrong would really appreciate it.

    Thanks In Advance

    And Thank You Marco for all your help

    Cheers
    Attached Files

    Leave a comment:


  • marcow
    replied
    As far as I know it is not possible to have 1 entry of 300 shares combined with 2 profit targets of 150 each using the default SetProfitTarget() command.

    It would be possible to create the 2 profittargets by creating 2 Limit orders with the ExitLongLimit() command. This is a rather complicated procedure, and would advice you not to follow in this early stage of your strategy. If the stratgey is profitable, those few extra dollars commission won't make a big difference on total profit, do they ?


    Marco
    Last edited by marcow; 12-01-2012, 07:33 PM.

    Leave a comment:


  • geotabs
    replied
    Thanks Marco

    I have tested it out today and the order trigger works perfect, the issue I am having is that it does send out 3 septate order to buy at market, so if I have 3 contracts or 300 share for stocks it will send out 3 buy orders of 100 shares each instead of 1 order of 300 shares, for contracts it is not a problem but for commissions on stocks this would as IB is .005 per share with minimum of 1 dollar so if I wanted 900 share the commissions would be more on 3 separate orders than just 1.

    I tried modifying your original code to allow 2 targets with 1 entry but when filled still only has 1 target, can you take a look and see where I'm going wrong.

    Thanks
    Attached Files

    Leave a comment:


  • marcow
    replied
    If I want to trade 1 entry with 3 targets do I just comment out the entry 2 and 3?
    1 entry means enter long or short with 1 contract, so you cannot have 3 profit targets.
    If you mean enter long or short with 3 contracts at the same time each with its own profitarget, that is exactly what the latest version is supposed to do. If you want to enter with 2 contracts, you have to comment out all the "entry_3" long and short entries in the code (that would be line 98 and 110) Does that make sense ?


    I just loaded the strategy and noticed that you are not able to select the target values only the 1 stop value of 20
    And I suppose you want to get that fixed ?
    Although they are selectable by editing the values in the SetProfitTarget statements in the strategy code ( in the Initialize() method ) , I admit it is not the most elegant way.
    Please find attached an updated strategy with the profitargets user selectable in the parameters window.

    Marco
    Attached Files

    Leave a comment:


  • geotabs
    replied
    Thanks Marco

    If I want to trade 1 entry with 3 targets do I just comment out the entry 2 and 3?

    Thanks Again

    PS
    I just loaded the strategy and noticed that you are not able to select the target values only the 1 stop value of 20
    Last edited by geotabs; 11-29-2012, 05:29 PM.

    Leave a comment:


  • marcow
    replied
    I see where I went wrong on entering the code
    understanding why it went wrong is the key to good programming

    Yes, the strategy I posted has 3 entries. Entry_1 has a profittarget of 10, entry_2 has PT of 20 and entry_3 has PT of 30.
    If you want to trade only 2 contracts, just comment out lines for the entries#3 (line 95 and 107) in the code. For 1 contract also comment out the entries#2 (I ussume you know how to comment out code do you ? just in case: put "//" in front of it so it turns green )

    please find attached an updated version of the strategy, the stoploss for each entry didn't work correctly.

    Marco
    Attached Files

    Leave a comment:


  • geotabs
    replied
    Thanks Marco,

    I see where I went wrong on entering the code
    What I need this strategy for is for tick and 1 min charts

    As for profit targets:
    What I want is for 1 entry and 3 profit targets, so if I go long 3 contracts take profit at 10,20 and 30 ticks or 5,10 and 15 ticks depending on what I trade. Also if I only trade 2 contracts would it just have 2 profit targets and so forth for 1 contract?

    I can't thank you enough for all the help Marco

    Cheers

    Leave a comment:


  • marcow
    replied
    What I want is for the indicator to CalculateOnBarClose = true; but the order entry to trigger at the last price on chart so if last price is equal to the TsSupertrend then it will place order and not wait for bar close.
    geotabs,
    after reading your request in post#400 again, I realize that what you want can surely be done, but it is kind of risky. Here's why.
    Imagine the price crosses below the green supertrend line intrabar, and the strategy enters a short position. What if the price goes up in that same bar, and that bar closes above the green line, so Supertrend remains on a long position ? There will be no upper red line to reverse this short position to long. You get a mismatch between indicator and strategy. Or do you want to use the stoploss to exit this position ?

    please find attached the strategy as you requested. You can also see here how the OnMarketData() method is correctly integrated in the code. Import by copying the attached file in your strategies directory (C:\Users\*****\Documents\NinjaTrader 7\bin\Custom\Strategy), and then compile in NT

    Also how would I add an extra target or 2?
    Do you mean that you have multiple entries, and want to set a unique profittarget for each entry ?
    The strategy attached takes 3 entries, with a profittarget of 10,20 and 30 ticks.please take a look at the code on line 55,56,57,91,92,93,103,104,105. The trick is to give each entry a unique name, and use that name in its profittarget, so NT knows which PT belongs to each entry.


    Let me know if the strategy does what you want, or if you have other ideas.

    Marco
    Attached Files

    Leave a comment:


  • geotabs
    replied
    Thanks Marco

    I don't have any programming skills, I did what you said and put the code in but am getting an error, I attached a picture showing the error.
    Also how would I add an extra target or 2?

    Thanks Again
    Attached Files

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
0 responses
652 views
0 likes
Last Post Geovanny Suaza  
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
0 responses
370 views
1 like
Last Post Geovanny Suaza  
Started by Mindset, 02-09-2026, 11:44 AM
0 responses
109 views
0 likes
Last Post Mindset
by Mindset
 
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
0 responses
574 views
1 like
Last Post Geovanny Suaza  
Started by RFrosty, 01-28-2026, 06:49 PM
0 responses
577 views
1 like
Last Post RFrosty
by RFrosty
 
Working...
X