Sample Advanced Automated Strategy v1.0 - futures io
futures io



Sample Advanced Automated Strategy v1.0


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one dsraider with 36 posts (41 thanks)
    2. looks_two wgreenie with 21 posts (1 thanks)
    3. looks_3 gg80108 with 11 posts (6 thanks)
    4. looks_4 Ducman with 7 posts (0 thanks)
      Best Posters
    1. looks_one MXASJ with 3 thanks per post
    2. looks_two dsraider with 1.1 thanks per post
    3. looks_3 cbritton with 0.7 thanks per post
    4. looks_4 gg80108 with 0.5 thanks per post
    1. trending_up 36,381 views
    2. thumb_up 64 thanks given
    3. group 27 followers
    1. forum 117 posts
    2. attach_file 15 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Sample Advanced Automated Strategy v1.0

(login for full post details)
  #1 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

People of the interweb,

With the help of several sample strategies I found on the NT forum and a little ingenuity, I have put together a fully-automated, advanced strategy which does the following:

1. Only enters between 10:15 AM and 3:15 PM (EST) (allows for second time frame as well)
2. Shuts down if PnL is more than $1,000 or less than -$300
3. Enters limit orders for long and short based on signal
4. Covers three time frames but will only have one active position open at a time
5. Cancels entry order if market moves four ticks away from limit order without filling
6. Sets an initial stop at 12 ticks, then changes to breakeven at +4 ticks and trails, tick by tick, from there
7. Scales out of half position at +4 ticks (1st profit target) and covers second half position at +8 ticks (2nd profit target)

Good news: All parameters can be changed to suit your needs. Please feel free to add to, delete or change anything in the code. All that I ask is that you don't sell my hard work for profit.

Bad news: As I have been coding C# for roughly 2.5 weeks, the contents of the strat pretty much consists of everything I know about coding. Therefore, if you want something drasticly changed, I will most likely not know how.

I am creating this thread so that we may all help to make it better, if need be, so please keep all comments and requests to this thread. As of now, the only thing with which I am not thrilled is the CancelOrder() code. It USUALLY works fine, but sometimes it surprises me. I am open to suggestions for how to make that, or any other part, better.

Click below for the strat. To install: Control Panel ---> File ---> Utilitites ---> Import Ninjascript...

Thanks and happy trading,
Dave

SampleAdvancedAutomatedStratv1.1

UPDATE:
v.1.1 - 2/23/10
1. Fixed CancelOrder() code.
2. Added arrows and chart name plots (since plots will only show on main chart, this lets you know which time frame just took the trade).

If you cannot see your full chart name once plotted: Right-click on chart ---> Properties ---> Right Side Margin

Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(609 thanks from 61 posts)
looks_twoSalao's Journalby Salao
(155 thanks from 28 posts)
looks_3Learning to Profit - A journey in algorithms and optionsby Syntax
(115 thanks from 27 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(94 thanks from 30 posts)
looks_5Maybe a little bit different journalby Malykubo
(53 thanks from 32 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
I finally blew up an account
524 thanks
The Crude Dude Oil Trading System
80 thanks
Spoo-nalysis ES e-mini futures S&P 500
64 thanks
The tiyfTradePlanFactory indicator
25 thanks
Building a Crypto Mining Rig
18 thanks
 
(login for full post details)
  #3 (permalink)
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
 
cclsys's Avatar
 
Posts: 607 since Nov 2009
Thanks: 248 given, 392 received


Thank you very much. Having sample strategies like this is extremely helpful for those who don't know all the ins and outs of NT strategy programming.

One feature I would like to see an example of is very simple but don't know how to do it: I like to make stops and PT's variable by reference to expanding/contracting ATR versus fixed tick sizes.

Now in theory I think all one has to do is have a tick size PT input (for example) but then multiply it by an ATR ratio.

If the short-term ATR is greater than longer term ATR, then if that is divided by the longer term you get a ratio (say 1.25), so the PT tick input can be multiplied by 1.25 to get the current PT amount. As I said, very simple in concept.

But how to do that within strategy coding I am not sure. Now that I have your template I can try (when I have time). Also there is the Hurley sample strategy here on the forum thanks to BM. But if any other expert would like to add that in, I am sure I am not the only person who would find it a very helpful snippet to have handy. Good for stops, profit targets, entry conditions etc.

More importantly, makes it possible to test the same strategy on different tick/time/instrument charts to find bell-curve ratios that work best rather than having to optimize each instrument and tick/time chart each time which creates over-optimization type problems with system design in general, but especially with intraday systems using short term data/bars.

Ideally (imho) all you need to optimize on a system should be
a) profit-to-loss ratio
b) volatility quotient applied to
c) stops and profit targets.

a) is a simple ratio which is a double expressing ratio of PT to stop (say), i.e. 2 = PT is 2*stop.
b) is the Stop in ticks (one input) with a second input which is the volatility multiplier (i.e. test from .5 to 2.5).

This means there are only 3 inputs to test: the P-L ratio, the volatility multiplier, and the base stop price in ticks.

If you want to get it down to only 2 inputs to optimize then the stop itself is a function of the volatility multiplier so that one multiplier optimizes the stops and PT's whilst the second input is the PT-Stop ratio which expands and contracts the PT relative to the initial stop price.

Having only two inputs to optimize on any given system makes for far more robust systems.

At least in theory!

PS: on looking at this noticed that most things are not inputs already so for myself I shall experiment with the Hurley since the times of day etc. are optimizable etc.

Of old the skilled first made themselves invincible to await the enemy's vincibility.
Invincibility lies in oneself. Vincibility lies in the enemy.
Thus the skilled can make themselves invincible.
They cannot cause the enemy's vincibility.
Thus it is said: 'Victory can be known; it cannot be made.'
Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to cclsys for this post:
 
(login for full post details)
  #4 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

cclsys,

First, thanks for your kind words. I'm a firm believer in giving back.

Second, I don't fully follow you but if you'd like to post a screenshot that helps me understand this in layman's terms, I'd be happy to give it a shot.

Thanks,
Dave

Reply With Quote
 
(login for full post details)
  #5 (permalink)
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
 
cclsys's Avatar
 
Posts: 607 since Nov 2009
Thanks: 248 given, 392 received

Dsraider: cannot program NT strategies unfortunately so no screenshots. Just a thought. A little 'bee in my bonnet' with strategies that I think I have been harping on too much about past few days. Would just love to see a simple strategy with this capability. Had many in TS and always found it very helpful.

Of old the skilled first made themselves invincible to await the enemy's vincibility.
Invincibility lies in oneself. Vincibility lies in the enemy.
Thus the skilled can make themselves invincible.
They cannot cause the enemy's vincibility.
Thus it is said: 'Victory can be known; it cannot be made.'
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #6 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 799 received

Don't know if it helps dsraider but I'm testing something now that uses a bool for trade times and session P&L. Whether the strategy looks at those can be switched on or off before you start the strategy.

In the variables area I have

private bool useTradeTimes = false;
private bool useSessionPnL = false;

And a bunch of user configurable parameters related to those two options.

Then in the OnBarUpdate area I have:

 
Code
                            
if (UseSessionPnL == true && Position.MarketPosition == MarketPosition.Flat && (Performance.AllTrades.TradesPerformance.Currency.CumProfit priorTradesCumProfit >= sessionProfitTarget
|| Performance.AllTrades.TradesPerformance.Currency.CumProfit priorTradesCumProfit <= (-1*sessionLossLimit)))
PrintWithTimeStamp("STRATEGY Erratic NT7: " Instrument.FullName " HALTED by Session P&L Logic");
return;
 
if (
UseTradeTime==true && ToTime(Time[0]) <= tradeStartTime || ToTime(Time[0]) >= tradeEndTime) return; 
I've lifted your Trail Stop code and I'm testing it now. I note you are not using ExitLongStop and ExitLongLimit in your code and are instead using SetStopLoss and SetProfitTarget. Any reason for that? This is the first time I've really looked at IOrders.

Reply With Quote
The following user says Thank You to MXASJ for this post:
 
(login for full post details)
  #7 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

cclsys - I actually meant a screenshot of your chart, only because I'm not familiar with that ATR formula. I was thinking that if I saw an example, I might be able to come up with a code snippet that does what you want (emphasis on MIGHT).

MXASJ - You're making me nervous. My time of day and PnL codes have been working perfectly for me. Did they not work for you? As far as using SetStopLoss/SetProfitTarget is concerned, as of now, I exit my trades solely based on how many ticks I want. I don't really have an actual exit strategy. If and when I do, I'll definitely use ExitLong at that point. Oh, for the trail to work properly, make sure you have CalculateOnBarClose set to false. This ensures that the "Close[0]" part of the trail means current price, so it will trail exactly how it's supposed to.

Thanks guys,
Dave

Reply With Quote
 
(login for full post details)
  #8 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 799 received


dsraider View Post
MXASJ - You're making me nervous. My time of day and PnL codes have been working perfectly for me. Did they not work for you?

If it works for you leave it alone . I like the option of being able to turn that on/off without commenting out the code, but that's just me.

Reply With Quote
 
(login for full post details)
  #9 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Ahh, okay. Just checking. I actually don't trust myself enough to have that power. I used to be really bad about revenge trading, etc, so this helps keep me from being my own worst enemy.

Hope your code works for you and thanks again for the suggestion. Let me know if you run into any issues with whatever you grab from mine. I'm STILL working on my CancelOrder code. Once that's done, I'll repost with a few other minor additions.

Dave

Reply With Quote
 
(login for full post details)
  #10 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 799 received


Paying it forward, dsraider. My code is not as good as yours but you might get an idea or two out of it for further development (switching trade times and session P&L off, for example). Attached is NT7 only I'm afraid but here you go.

Attached Files
Register to download File Type: zip SimpleFramework.zip (2.1 KB, 298 views)
Reply With Quote
The following 8 users say Thank You to MXASJ for this post:
 
(login for full post details)
  #11 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received


MXASJ View Post
Paying it forward, dsraider.

Apologies for the late reply, MXASJ. I like your bool idea a lot. Though I coudn't install into 6.5, it looks like I can copy and paste from the .cs without a problem. If and when I ever trust myself again, I will definitely update to this.

Thanks and nice work.

Dave

P.S. As promised, I've posted an updated version of the strat (see first post). It now cancels perfectly and plots arrows and chart names.

Reply With Quote
 
(login for full post details)
  #12 (permalink)
 zeller4 
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received


dsraider View Post
P.S. As promised, I've posted an updated version of the strat (see first post). It now cancels perfectly and plots arrows and chart names.

Hey Dave, thanks for the update.
Not sure if the moderator has a special way to do this but if you could save your new file name with the v# before zipping, as well as posting the updates in the header of the cs file, we could be sure we have the most current version - ie if your zip is named v1.1, it'd be good if the cs file also has the designation. I can't put "." in filenames though so my way of doing that may not be the preferred method.

Thanks,
Kirk

Reply With Quote
 
(login for full post details)
  #13 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Hi Kirk,

Good idea. Done and done. I can't use symbols either so I called it v1point1 in the code. Question, though...even though the updated version downloads properly, it says v1.0 when you click the download link. Any chance you know how to change that?

Thanks,
Dave

Reply With Quote
 
(login for full post details)
  #14 (permalink)
 zeller4 
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

no, I didn't understand how you got it that way, I've never posted in the downloads area...

thanks for updating
Kirk

Reply With Quote
 
(login for full post details)
  #15 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Haha I'm obviously talented. I'll keep trying...

Reply With Quote
 
(login for full post details)
  #16 (permalink)
 eensor 
New Braunfels, TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: futures
 
Posts: 127 since Aug 2009
Thanks: 922 given, 20 received

Hi,

How do you turn the strategy on and off?

Thanks,
Edie

Reply With Quote
 
(login for full post details)
  #17 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Edie,

You mean to have it actually trade for you? Either click the strategy icon on the chart toolbar and add it like you would an indicator or right click on chart and hit strategies. Make sure to select your live or sim account at the top, once you've added it. If you meant something else, let me know.

Dave

Reply With Quote
 
(login for full post details)
  #18 (permalink)
 eensor 
New Braunfels, TX
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: futures
 
Posts: 127 since Aug 2009
Thanks: 922 given, 20 received

That is it.
Thanks very much.

Eddie

Reply With Quote
 
(login for full post details)
  #19 (permalink)
 cbritton 
Atlanta, Georgia
 
Experience: Intermediate
Platform: NT
Broker: DDT
Trading: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 249 received

Good work, dsraider!

I was thinking about doing something similar by separating out the modular portions of strategy building in general. The "base" part of it (borrowing from object oriented programming) handles the trade management that I'm finding is common to most of my strategies while the extensions to the base handles the logic of the entry signals.

-c

Reply With Quote
The following user says Thank You to cbritton for this post:
 
(login for full post details)
  #20 (permalink)
 cbritton 
Atlanta, Georgia
 
Experience: Intermediate
Platform: NT
Broker: DDT
Trading: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 249 received


cclsys View Post
Thank you very much. Having sample strategies like this is extremely helpful for those who don't know all the ins and outs of NT strategy programming.

One feature I would like to see an example of is very simple but don't know how to do it: I like to make stops and PT's variable by reference to expanding/contracting ATR versus fixed tick sizes.

Now in theory I think all one has to do is have a tick size PT input (for example) but then multiply it by an ATR ratio.

If the short-term ATR is greater than longer term ATR, then if that is divided by the longer term you get a ratio (say 1.25), so the PT tick input can be multiplied by 1.25 to get the current PT amount. As I said, very simple in concept.

...

cclsys,

I like this approach, but how do you define short-term ATR and long-term ATR? Is the long term ATR based on a different timeframe? For example, the short-term ATR is the ATR(some length) for 1 minute charts and long-term is the same on 5 minute charts?

Thanks,
-c

Reply With Quote
 
(login for full post details)
  #21 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Hi Dave

My heartfelt thanks for sharing your strategy with us. I can tell the additional efforts you spent to make it simple and yet very comprehensive.

I've been studying it for almost 2 weeks now. As a newbie with minimal programming talents, my success as of this moment is having a BE condition triggered once the trade moves 8 ticks from my entry. All other efforts trying to include your Trail Stop code in different ways (that I could think of or tried) have not triggered a revised SL to protect some gained ticks even F5 compile successfully .. sigh ..

I am hoping maybe you will spare a few minutes going through my code and give me some tips on what I did wrong or how to make it work .. PLEASE!

 
Code
protectedoverridevoid Initialize()
{

EntriesPerDirection = 1; 
EntryHandling = EntryHandling.UniqueEntries;
CalculateOnBarClose = true;
}

privatevoid ManageOrders()
{
// Resets the stop loss to the original value when all positions are closed
if (Position.MarketPosition == MarketPosition.Flat)
{
SetStopLoss(CalculationMode.Ticks, 15);
}

// If a long position is open, allow for stop loss modification to breakeven
if (Position.MarketPosition == MarketPosition.Long)
{
// Once the price is greater than entry price +8 ticks, set stop loss to breakeven
if (Close[0] > Position.AvgPrice + 8 * TickSize)
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice);
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoTrail.wav");
}
}

// Once at breakeven wait till trailProfitTrigger is reached before advancing stoploss by trailStepTicks size
elseif (previousPrice != 0// SL is at Breakeven
&& Close[0] > previousPrice + trailProfitTrigger * TickSize)
{
newPrice = previousPrice + trailStepTicks * TickSize;
SetStopLoss(CalculationMode.Price, newPrice);
previousPrice = newPrice;
PrintWithTimeStamp("previousPrice = "+previousPrice);
PrintWithTimeStamp("newPrice = "+previousPrice);
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoTrail.wav");
}

// If a short position is open, allow for stop loss modification to breakeven
if (Position.MarketPosition == MarketPosition.Short)
{
// Once the price is smaller than entry price -8 ticks, set stop loss to breakeven
if (Close[0] < Position.AvgPrice - 8 * TickSize)
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice);
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoTrail.wav");
}
}

// Once at breakeven wait till trailProfitTrigger is reached before advancing stoploss by trailStepTicks size
elseif (previousPrice != 0// SL is at Breakeven
&& Close[0] < previousPrice + trailProfitTrigger * TickSize)
{
newPrice = previousPrice - trailStepTicks * TickSize;
SetStopLoss(CalculationMode.Price, newPrice);
previousPrice = newPrice;
PrintWithTimeStamp("previousPrice = "+previousPrice);
PrintWithTimeStamp("newPrice = "+previousPrice);
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoTrail.wav");
}
}
Thank you very much .. very much in advance!

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #22 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Hi Beth,

I noticed you changed CalculateOnBarClose to true. When it's set to false, Close[0] means current price, which really helps with a trailing stop. When set to true, it has to wait until the bar closes before it looks to move the stop. That could be a problem. If you can explain to me how you want the trail to actually work, I'll take a shot at it.

Don't lose your mind. We'll figure it out.

Dave

Reply With Quote
The following user says Thank You to dsraider for this post:
 
(login for full post details)
  #23 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received


dsraider View Post
Don't lose your mind. We'll figure it out.

Dave

Hi Dave

Your Swift response has certainly lightened me up! Days (incl 2 weekends) were spent trying to make a trail stop work. Every F5 compile successfully message gave me hope and yet it's a no no at the end. Very heart-breaking and I feel stupid when I've your master piece as my guidance.

I did try CalculateOnBarClose @ false and my supposed trail stop has not triggered anything when I backtested the strategy.


What I've been trying to do:

For example,

1. Long at 1000 with SL at 985 (initial 15 ticks SL) and BE when it moves 8 ticks from entry
2. Price moves to 1008
3. BE condition moves SL to 1000 (from 985) - that's how far I've accomplished
4. Price continues moving to 1010 (1008 + 2)
5. Trail stop kicks in with SL adjusts to 1002 (1000 + 2)
6. Price continues moving to 1012 (1010 + 2)
7. Trail stop to have SL adjusted to 1004 (1002 + 2)
.. ..

For every 2-tick move, SL will be adjusted 2 ticks to protect some gained profits.

++

I moved the trail stop code around dozens times and nothing has happened after each F5 compile successful. I'm running out of gas and that prompted to knock at your door. My heartfelt thanks for your GIANT lift!

Beth (now a little relieved )

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #24 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Can you try this?:

 
Code
                            
#region Variables
        
        
private int        breakEvenTicks        8;
        private 
int        plusBreakEven        0;
        private 
int     trailProfitTrigger     9;
        private 
int        trailStepTicks        2;
        
        private 
double    initialBreakEven    0;
        private 
double     previousPrice         0;
        private 
double     newPrice             0;

#endregion

protected override void OnBarUpdate()

#region Trail Stop
                    // Only allow entries if we have no current positions open
                        
switch (Position.MarketPosition)
                    {
                        case 
MarketPosition.Flat:
                            
SetStopLoss(""CalculationMode.Ticks15false);
                                                        
previousPrice 0;
                            break;
                        case 
MarketPosition.Long:
                            
// Once the price is greater than entry price+ breakEvenTicks ticks, set stop loss to breakeven
                            
if (Close[0] == Position.AvgPrice breakEvenTicks TickSize && previousPrice == 0)
                            {
                                
initialBreakEven Position.AvgPrice plusBreakEven TickSize
                                
SetStopLoss(""CalculationMode.PriceinitialBreakEvenfalse);
                                
previousPrice Position.AvgPrice;
                                
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoTrail.wav");
                                
PrintWithTimeStamp("previousPrice = "+previousPrice);
                                
PrintWithTimeStamp("newPrice = "+previousPrice);
                            }
                                                        
// Once at breakeven wait till trailProfitTrigger is reached before advancing stoploss by trailStepTicks size step
                            
else if (previousPrice    != ////StopLoss is at breakeven
                                    
&& Close[0] > previousPrice trailProfitTrigger TickSize)
                                
                            {
                                
newPrice previousPrice trailStepTicks TickSize;
                                
SetStopLoss(""CalculationMode.PricenewPricefalse);
                                
previousPrice newPrice;
                                
PrintWithTimeStamp("previousPrice = "+previousPrice);
                                
PrintWithTimeStamp("newPrice = "+previousPrice);
                                
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoTrail.wav");
                            }
                            break; 
I've obviously left some things out, but these are the parts needed for what you want to do. Remember to set CalculateOnBarClose back to false (that's why I use FirstTickOfBar in my entry code). I'm wondering if OnBarUpdate makes a difference as well, as I just realized you switched it to ManageOrders. Anyway, let me know how it goes.

Dave

Reply With Quote
The following user says Thank You to dsraider for this post:
 
(login for full post details)
  #25 (permalink)
 cbritton 
Atlanta, Georgia
 
Experience: Intermediate
Platform: NT
Broker: DDT
Trading: ZN, ZB
 
cbritton's Avatar
 
Posts: 224 since Mar 2010
Thanks: 152 given, 249 received

I think you want this instead:

 
Code
                            
...
  
// Once at breakeven wait till trailProfitTrigger is reached before advancing stoploss by trailStepTicks size step
                            
else if (previousPrice    != ////StopLoss is at breakeven
                                    
&& Close[0] > previousPrice trailProfitTrigger TickSize)
                                
                            {
                                
newPrice previousPrice trailStepTicks TickSize;
                                
SetStopLoss(""CalculationMode.PricenewPricefalse);
                                
// print the previous price before it's changed
                                
PrintWithTimeStamp("previousPrice = "+previousPrice);
                                
previousPrice newPrice;
                                
PrintWithTimeStamp("newPrice = "+previousPrice);
                                
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoTrail.wav");
                            }
                            break;
... 
Otherwise you won't see the previous price being printed

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Reply With Quote
The following user says Thank You to cbritton for this post:
 
(login for full post details)
  #26 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

BIG BIG Thank You to Dave and cbritton for your prompt code suggestion. I have them in the strategy (+ CalculateOnBarClose at false) and it's running on sim now. For backtesting, the revised strategy has generated the same results (same trades etc) as the one without the trail stop code?!!

Maybe trail stop only works when it's on live. Will find out later today and please stay tuned to my report.

Have a Great day.

Beth (grateful for your guidance)

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #27 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Beth,

The trail should would on the sim. If it isn't, we have an issue. I may have to take a peek at your actual strat if we can't figure it out here, as I'm flying slightly blind. Maybe you can change around a few things if you'd like to keep your actual signal to yourself. Good luck for now. I'll check back after market close.

Dave

Reply With Quote
The following user says Thank You to dsraider for this post:
 
(login for full post details)
  #28 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Thanks Dave. No rush as I've been working on this for 2 weeks now. The strategy with trail got a little crazy after a few minutes. You will see from the enclosed log that it started to open and close a position within a second after Trade No 1. Just stopped it running.

I have a thread on my automation efforts here. I am trying to automate The Wizard's systems and the signals are well-known in the Big Mike community. Please let me know later tonight what will you need to find out what I did wrong. Thank You .. Thank You again from the bottom of my petite heart for your help!

Beth

Attached Thumbnails
Click image for larger version

Name:	YM Trade Log w Trail.JPG
Views:	254
Size:	250.6 KB
ID:	9489  
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #29 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

I'm guessing you will need to add FirstTickOfBar to your entry code and set your indicator conditions a bar back. So, instead of if(Close[0] > Open[0]) go long, you would use if(FirstTickOfBar && Close[1] > Open[1]) go long. Since CalculateOnBarClose = false makes Close[0] = current price, this allows you use close as a true close and prevents the strat from taking trades on every tick, like yours seems to be doing.

If you'd like to PM me the strat or post it here, I'll have a look. It's hard to tell what will work without knowing how you want to enter.

D

Reply With Quote
The following user says Thank You to dsraider for this post:
 
(login for full post details)
  #30 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Thanks Dave for your swift suggestion. I changed the entry conditions with FirstTickOfBar and [0] to [1] etc. Backtest results were different from the strategy without the trail (finally .. smile). Have it run on sim now and so far not generating trades every second - great news! Thanks to you.

Need to pick your brains on the following please:

1. trailProfitTrigger = 9;

8 + 1 formula with 8 being the breakEvenTicks? The trade needs to be 9 ticks away before the system starts adjusting the BE stoploss to BE + 2 ticks regularly (with 2 being the trailStepTicks), right?

2. With CalculateOnBarClose at false, I also changed the Exit condition. I'm not sure if I did correctly on the following CrossBelow:

(CrossBelow(d9ParticleOscillatorWVertLineR(7, 0).RawTrend, 0, 0)
which was (CrossBelow(d9ParticleOscillatorWVertLineR(7, 0).RawTrend, 0, 1)

Appreciate your advice. Thank you.

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #31 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Hey Beth,

The code I sent for your BE and trail will do the following:

Set initial SL at -15 ticks.
Move SL to breakeven when you are +8 ticks in profit.
Move SL up two ticks when you are +10 ticks in profit and every two from then on.

You changed my original code a little but I have it move to breakeven when price = +8 and then kick in the trail when price is > 9 (which translates to 10). Subtle changes can make all the difference.

As far as your exit is concerned, if you now have it set to current bar, it should exit the instant you get a cross. If you want to make sure it closes as a cross, go back to [1]. This exit is a bit of a guess, as I don't use one and so am not certain of how it responds to FirstTickOfBar, but it's a good guess.

Let me know if I have your trail strategy right and how this works out. Again, the trail will work in simulation mode in case you don't want to wait for actual market conditions to test.

Good luck,
Dave

Reply With Quote
 
(login for full post details)
  #32 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Hi Dave

Thanks for your best wishes. The strategy worked funny starting 3:28, ie in-and-out within a second (per enclosed trade log). I also notice the following:

1. Trade No 4 Long @557: It went up to 582 and there's a BE SL trade @557 (cancelled status) before its closing @572. If the trail code was working, should there be some trail stop orders listed on the Orders tab?

2. Starting Trade No 6, it triggered in-and-out trades until 3:43 (you will see the trade markers on the enclosed chart).

I have absolutely no idea what I did wrong when adding the trail code. Sorry! Enclosed is my strategy with the trail code + the required indicators in case you want to run it (the strategy is supposed to work best on a 4-tick MedianRenko chart).

My super-mega Thank You for checking it for me please! Thank You .. Thank You!

Beth

Attached Thumbnails
Click image for larger version

Name:	YM 03-10  3_10_2010 (MedianRenko 4 Ticks).jpg
Views:	277
Size:	166.7 KB
ID:	9503   Click image for larger version

Name:	YM Trade Log w Trail.JPG
Views:	198
Size:	111.9 KB
ID:	9505  
Attached Files
Register to download File Type: zip TheWizardv5ibRevised3timewTrail.zip (42.1 KB, 113 views)
Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to wgreenie for this post:
 
(login for full post details)
  #33 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Good news/Bad news....

The good news is I fixed your trail. Please make the following changes to your code:

SetStopLoss("Long ", CalculationMode.Ticks, 15, false); should be
SetStopLoss("", CalculationMode.Ticks, 15, false);

Also, in the trail part, (not the BE part) use:
SetStopLoss(longEntryID, CalculationMode.Price, newPrice, false); and
SetStopLoss(shortEntryID, CalculationMode.Price, newPrice, false);

The other problems you're having seem to be coming from your exit code. I ran into the same problems you did, until I commented that part out. The bad news, unfortunately, is that I don't know how to fix it. Maybe someone else more experienced with exits can give you a hand there. I'm sorry I couldn't be of more help. Let me know if you're able to solve it or if any other issues come up. And again, good luck.

Dave

Reply With Quote
The following user says Thank You to dsraider for this post:
 
(login for full post details)
  #34 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Thanks Dave for making the trail work. Time to celebrate!

I've made the suggested changes and will sim trade it tomorrow. Will try both false and true for CalculateOnBarClose unless you advise that true will not work for trail. Funny that the same Exit conditions (for those without trail) have been working over a week and no looping trades.

A member opines that

"Crazy multiple trades sometimes happens when set at CalculateOnBarClose = false. I think the strat gets overwhelmed."

Let's see what may happen tomorrow before my further investigation on the Exit conditions. My heartfelt thanks again Dave!

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #35 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

That is strange. Maybe if I were more experienced I'd be able to do more, but I'm really just a very, very stubborn newbie. I think setting it to true will not give you the results you want but I guess it doesn't hurt to try. Keep me posted. I hope you figure out the rest.

Dave

Reply With Quote
 
(login for full post details)
  #36 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Thanks Dave for your kind encouragement and best wishes. Hey, I'm lucky to have YOU fixing my trail code!

I will fix the [0] now to have CalculateOnBarClose: true version running as well. Will share the results with you.

Enjoy a Nice evening/Great Thu.

Beth (grateful)

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #37 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Beth,

Do me a favor. Can you add FirstTickOfBar to your exit and set the condition back one bar like we did with the entry? It just occurred to me to try this. I should have thought of it earlier.

Dave

Reply With Quote
 
(login for full post details)
  #38 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Thanks Dave. I did set the exit conditions back one bar like we did with the entry. Just added "FirstTickOfBar" per your kind suggestion.

Close[0]<Low[1] and Close[0]>High[1] is one of the exit conditions for Long and Short respectively. I just noticed this version is more profitable than Close[1]<Low[2] and Close[1]>High[2] when I backtested the strategy. (Oh, it's an inadvertent error when I fixed the "back one bar" earlier.)

I wonder if I should keep this as-is or try both versions live tomorrow. What do you think?

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #39 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

I think you should go long 10 cars at open with no stops or targets and run screaming from your home! Okay, okay, I'm just kidding.

I see harm in trying both. I've read too many bad things about the inaccuracies of backtesting, so I'm all about testing live. Either way, I'll be happy if the strat works how it's supposed to.

Let me know,
D

Reply With Quote
 
(login for full post details)
  #40 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

You're right on Dave! We canNOT trust backtest results especially MedianRenko ones. I learned this after backtesting my draft strategies and got really really excited LOL! Yes, only sim results (or maybe Market Replay ones) are more reliable.

Wish me luck tomorrow!

Night-night.

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #41 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Good luck and goodnight,

Dave

Reply With Quote
 
(login for full post details)
  #42 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Hi Dave

With your best wishes, my 3 computers (I borrowed one from my hubby) have been working very diligently this morning.

1. One is running 4 strategies (3 YM and 1 ES) with trail.

i. ES is the only one that seems normal and no looping trades. It did 2 trades and both marginally profitable. It does have CalculateOnBarClose @false.

ii. 2 YM ones @false and one @true. All chopped a nice short ride into numerous trades. The 2 @false ones chopped it into 8 while the @true one made it into 4.

Well, I have no clue what's going on. Oh, even one of the 3 YM charts looked different from the other two. I may have overloaded my computer LOL!

2. One was running 2 strategies on ES and YM until 12:00 noon before Ninja got frozen and I had to close it .. sigh ..

3. With one I was doing Market Replay on the strategies with trail on early March data. Looping trades again and the worst one so far chopped a nice trade into 20 trades - gosh!

I will need to research more on how to have a trail code that will not cause choppy trades. Plus I will review my strategies again to locate any coding issues that may have caused it and not the trail code.

Dave, I am very grateful for your assistance. Will knock at your door when I need your advice. Thank you!!!!!

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #43 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Geeze...

Just so I know, this is WITH FirstTickOrBar and [1] in the exits as well as the entries?

Reply With Quote
 
(login for full post details)
  #44 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Yes Dave. Newbie me followed your kind suggestion to the dot!

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #45 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Hmm...then I'm afraid I'm out of ideas. There's obviously a conflict in the code but I'm truly no expert. With any luck, someone will download yours, as it's very good, and find it. So, I'll keep my fingers crossed for you.

D

Reply With Quote
 
(login for full post details)
  #46 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

.. knock .. knock .. Dave, need to pick your brains please (for my learning purpose).

For ES, I have the following:

 
Code
privateint breakEvenTicks = 4;
privateint plusBreakEven = 0;
privateint trailProfitTrigger = 4;
privateint trailStepTicks = 1;
 
privatedouble initialBreakEven = 0;
privatedouble previousPrice = 0;
privatedouble newPrice = 0; 

privateint stoplossticks = 10;
 
case MarketPosition.Long:
// Once the price is greater than entry price+ breakEvenTicks ticks, set stop loss to breakeven
if (Close[0] == Position.AvgPrice + breakEvenTicks * TickSize && previousPrice == 0)
{
initialBreakEven = Position.AvgPrice + plusBreakEven * TickSize;
debug ("Moving stop up to "+Position.AvgPrice);
SetStopLoss(longEntryID, CalculationMode.Price, initialBreakEven, false);
previousPrice = Position.AvgPrice;
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoTrail.wav");
PrintWithTimeStamp("previousPrice = "+previousPrice);
PrintWithTimeStamp("newPrice = "+previousPrice);
}
// Once at breakeven wait till trailProfitTrigger is reached before advancing stoploss by trailStepTicks size step
elseif (previousPrice != 0////StopLoss is at breakeven
&& Close[0] > previousPrice + trailProfitTrigger * TickSize)
 
{
newPrice = previousPrice + trailStepTicks * TickSize;
SetStopLoss(longEntryID, CalculationMode.Price, newPrice, false);
previousPrice = newPrice;
//print the previous price before it's changed
PrintWithTimeStamp("previousPrice = "+previousPrice);
PrintWithTimeStamp("newPrice = "+previousPrice);
PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\AutoTrail.wav");
}
break;
For the enclosed chart, there's a long @1039. It went up to 1041 yet the trade was closed @1039.25 (a SL order). My understanding on the above code is SL to BE after a 4-tick move. Then SL will be adjusted 1 tick continuously as the trade is working before getting stopped out.


Instead, the trade was closed early (in my mind) and the system re-entered again at 1041!? If the trail code was working, shouldn't the trade be closed around 1040 and there would not be a re-entry?

Please help fixing my understanding! Thank you.

Beth

Attached Thumbnails
Click image for larger version

Name:	ES 06-10  3_11_2010 (MedianRenko 4 Ticks).jpg
Views:	183
Size:	162.0 KB
ID:	9577  
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #47 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Your understanding is right on. That's exactly what it should have done. Did you have more than one position open at the time? Also, the reentry shouldn't have anything to do with the trail, but with your entry. Did you add FirstTickOfBar and set everything back a bar on this one too? I couldn't tell if you added this strat to each instrument or created different ones for each.

Reply With Quote
 
(login for full post details)
  #48 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Great to learn that my understanding is right on even it's not doing what it's supposed to do.

Yes, the strategy has FirstTickOfBar and I've set everything back a bar on both entry and exit conditions. My strategy only allows one trade (one open position) at a time and no multiple-trades.

I checked the long trade in question and its closing was not triggered by one or both of the exit conditions. Sooo, it's another mystery ooo .. I may soon be a collector of mysteries .. haha ..

Thanks again Dave!

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #49 (permalink)
stockdisk
toronto,ontario
 
 
Posts: 15 since Nov 2009
Thanks: 6 given, 33 received

hi , i downloaded the strategy and inported the file with success, i am connected and charttrader is disabled but still my strategy icon is diabled same thing when i click right on chart ,strategy is greyed out .am i doing something wrong. thanks for the help

thaks

Reply With Quote
 
(login for full post details)
  #50 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

stockdisk,

Are you using the free version of NT? If so, it doesn't allow for strategies.

Reply With Quote
 
(login for full post details)
  #51 (permalink)
stockdisk
toronto,ontario
 
 
Posts: 15 since Nov 2009
Thanks: 6 given, 33 received

yes ,thanks for your quick reply,i have live paid on my desktop will try there ,thanks again for quick reply

Reply With Quote
 
(login for full post details)
  #52 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Okay, let me know if it works?

Reply With Quote
 
(login for full post details)
  #53 (permalink)
 gg80108 
Castle Pines N, CO.
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp Futures/Zen-Fire)
Trading: ES
 
Posts: 201 since Jul 2009
Thanks: 196 given, 130 received


dsraider View Post
People of the interweb,

With the help of several sample strategies I found on the NT forum and a little ingenuity, I have put together a fully-automated, advanced strategy which does the following:

1. Only enters between 10:15 AM and 3:15 PM (EST) (allows for second time frame as well)
2. Shuts down if PnL is more than $1,000 or less than -$300
3. Enters limit orders for long and short based on signal
4. Covers three time frames but will only have one active position open at a time
5. Cancels entry order if market moves four ticks away from limit order without filling
6. Sets an initial stop at 12 ticks, then changes to breakeven at +4 ticks and trails, tick by tick, from there
7. Scales out of half position at +4 ticks (1st profit target) and covers second half position at +8 ticks (2nd profit target)

Good news: All parameters can be changed to suit your needs. Please feel free to add to, delete or change anything in the code. All that I ask is that you don't sell my hard work for profit.

Bad news: As I have been coding C# for roughly 2.5 weeks, the contents of the strat pretty much consists of everything I know about coding. Therefore, if you want something drasticly changed, I will most likely not know how.

I am creating this thread so that we may all help to make it better, if need be, so please keep all comments and requests to this thread. As of now, the only thing with which I am not thrilled is the CancelOrder() code. It USUALLY works fine, but sometimes it surprises me. I am open to suggestions for how to make that, or any other part, better.

Click below for the strat. To install: Control Panel ---> File ---> Utilitites ---> Import Ninjascript...

Thanks and happy trading,
Dave

SampleAdvancedAutomatedStratv1.1

UPDATE:
v.1.1 - 2/23/10
1. Fixed CancelOrder() code.
2. Added arrows and chart name plots (since plots will only show on main chart, this lets you know which time frame just took the trade).

If you cannot see your full chart name once plotted: Right-click on chart ---> Properties ---> Right Side Margin

I have been working on a similar strategy and came across in NT help something about using OnExecution to drive a strategy based on fills rather then OnOrderUpdate,,https://www.ninjatrader-support.com/HelpGuideV6/helpguide.html
Any opinion on this?
Don

Reply With Quote
 
(login for full post details)
  #54 (permalink)
precisetrader
United States
 
 
Posts: 5 since Feb 2010
Thanks: 1 given, 2 received

It looks interesting, I will make it a try and let you know how it works for, me, thanks for sharing

Reply With Quote
 
(login for full post details)
  #55 (permalink)
 jgreene 
Palm City, Fl
 
Experience: Beginner
Platform: Ninja
Broker: NinjaTrader Brokerage
Trading: Futures
 
Posts: 23 since Mar 2010
Thanks: 5 given, 5 received

I must be missing something. I downloaded Sample Advanced Automated Strategy v1.0 on my Desktop and imported it to Ninja. I opened an ES 5 minute chart, invoked the strategy and nothing happened. I played with different time setttings and different instruments but no go. I use Ninja 6.something and not 7

Any suggestions. BTW, thanks for all the work.

Jack Greene

Reply With Quote
 
(login for full post details)
  #56 (permalink)
 zikonc 
san ramon
 
Experience: Beginner
Platform: ninja
Broker: zen
Trading: es, 6e
 
Posts: 136 since Oct 2009
Thanks: 98 given, 76 received

I am not sure what you are expecting to happen but maybe this will help.....you have "if (Historical) return;" condition, ......

https://www.ninjatrader-support.com/HelpGuideV6/helpguide.html

and search for Historical.........

Reply With Quote
 
(login for full post details)
  #57 (permalink)
 jgreene 
Palm City, Fl
 
Experience: Beginner
Platform: Ninja
Broker: NinjaTrader Brokerage
Trading: Futures
 
Posts: 23 since Mar 2010
Thanks: 5 given, 5 received

If I understand a strategy, one must first open a chart and set the instrument you want to trade, then the timeframe and then number of days back and this will creat the chart.

Once the chart is created, I open the strategy section, select the strategy, hit new and then either apply or OK.

Am I doing this correctly or is their something I am missing?

Thanks

Reply With Quote
 
(login for full post details)
  #58 (permalink)
 gg80108 
Castle Pines N, CO.
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp Futures/Zen-Fire)
Trading: ES
 
Posts: 201 since Jul 2009
Thanks: 196 given, 130 received

Looks like NT support knows there stuff,, the “0” is the printout of getting the entry price.. Does 3 or 4 gyrations before the entry price shows up.. By then the it wont take any stop orders..

The next printout uses the execution method, and the price shows up right away..

Attached Files
Register to download File Type: txt iexecution.txt (8.6 KB, 65 views)
Reply With Quote
 
(login for full post details)
  #59 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

jgreene,

What you're doing sounds right. Maybe post a screen shot of the chart with the strategy window up? I made this thing in 6.5 so that shouldn't be the issue.

Dave

Reply With Quote
 
(login for full post details)
  #60 (permalink)
 jgreene 
Palm City, Fl
 
Experience: Beginner
Platform: Ninja
Broker: NinjaTrader Brokerage
Trading: Futures
 
Posts: 23 since Mar 2010
Thanks: 5 given, 5 received


dsraider View Post
jgreene,

What you're doing sounds right. Maybe post a screen shot of the chart with the strategy window up? I made this thing in 6.5 so that shouldn't be the issue.

Dave

Dave,

Thanks so much for your post. I can not seem to be able to copy and paste so I have attached a .jpg file.

Jack

Attached Thumbnails
Click image for larger version

Name:	Dave_6B_Strat.jpg
Views:	158
Size:	194.4 KB
ID:	10984  
Reply With Quote
 
(login for full post details)
  #61 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Okay, I MIGHT have a solution. The default settings for this strat (if memory serves) are set to volume charts. I once read that using a multi-timeframe strat requires not only that all charts are the same (time, volume, range) but that the main chart needs to be the lowest common denominator of all of them. So, if you know how, try changing the latter two from volume to say, 30 and 60 minute charts, and try again.

Let me know if you need help doing that. Otherwise, let me know if that made it work.

Dave

Reply With Quote
 
(login for full post details)
  #62 (permalink)
 gg80108 
Castle Pines N, CO.
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp Futures/Zen-Fire)
Trading: ES
 
Posts: 201 since Jul 2009
Thanks: 196 given, 130 received

Here is what I got from Ninja Support... Its pretty cool if you use CurrentBar BarsInProgress == 0 and BarsInProgress ==1 and see how your bars line up.. I had to do this to figure out where to reset my variables..

Dear gg80108,

NinjaTrader_RyanM has just replied to a thread you have subscribed to entitled - BarsInProgress - in the Strategy Development forum of NinjaTrader Support Forum.

This thread is located at:
BarsInProgress - NinjaTrader Support Forum

Here is the message that has just been posted:

***************
Hello GG80108,

Yes, you can combine range with minute bars when working with BarsInProgress. Series do not have to be part of the same structure.

Main thing to check is that you have the underlying data for the series you're accessing.

Tick - tick data
Volume - tick data
Range - tick data
Second - tick data
Minute - minute bar data
Day - daily bar data
Week - daily bar data
Month - daily bar data
Year - daily bar data
***************

There may be other replies also, but you will not receive any more notifications until you visit the forum again.

Regards,
NinjaTrader Customer Service

Reply With Quote
The following user says Thank You to gg80108 for this post:
 
(login for full post details)
  #63 (permalink)
 PandaWarrior 
In the heat
 
Experience: None
 
PandaWarrior's Avatar
 
Posts: 3,163 since Mar 2010
Thanks: 6,328 given, 13,385 received

I applied this strategy to my chart....nothing happened. I used a 5 min chart, a 4 range chart and 1000 chart. No dice.

I know you cannot have chart trader running in order to use strategies, so chart trader is not on.

Any suggestions?

Reply With Quote
 
(login for full post details)
  #64 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

aztrader9,

The post above talks about how to use different kinds of charts (tick, time, vol), which is beyond the scope of my programming knowledge. That might be the problem. Can you go into the code and comment out the second and third charts and try it again tomorrow? Also, what NT are you using? I built this in 6.5 and haven't personally tested it in 7. In fact, if anyone has done that successfully, please let me know.

Thanks,
Dave

Reply With Quote
 
(login for full post details)
  #65 (permalink)
 gg80108 
Castle Pines N, CO.
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp Futures/Zen-Fire)
Trading: ES
 
Posts: 201 since Jul 2009
Thanks: 196 given, 130 received

Works great in NT7.14,, I did add the getting the actual fill price using Iexecution, since I set my stops and targets from this price and wanted it to be accurate..

Be sure to comment out the if History and the two brackets since this encompasses the whole strategy, if it doesn't work straight away...

I think the key to the post about data for me is u put the code that matches the chart u want to run against in a
if (BarsinProgress == 0)structure.. 0 is the main chart and your adds in the initialize count 1 for the first entry 2 for the second, etc,etc..

Reply With Quote
The following user says Thank You to gg80108 for this post:
 
(login for full post details)
  #66 (permalink)
 eman 
Galveston ,TX
 
Experience: Intermediate
Platform: NT7
Broker: Zaner
Trading: Futures
 
Posts: 386 since Mar 2010
Thanks: 364 given, 433 received


dsraider View Post
stockdisk,

Are you using the free version of NT? If so, it doesn't allow for strategies.

are you sure about that? a friend of mine is able to load and run strategies that i code for him on his free license with no issues.

enjoying this thread and looking forward to reviewing your code. thanks for sharing/posting

cheers,
-e

Reply With Quote
 
(login for full post details)
  #67 (permalink)
 ZTR 
 
Experience: Advanced
Platform: NinjaTrader7
Broker: Mirus RCG/Zen-Fire
Trading: CL & 6e, looking at ES, ZB and AU again.
 
ZTR's Avatar
 
Posts: 2,099 since Nov 2009
Thanks: 1,099 given, 1,392 received

I tested stratigies from 2 different members, the strats burned up money, but they ran, on NT7.

I was running a sim only version at the time for testing, with a live ZenFire feed.

R.I.P. Andy Zektzer (ZTR), 1960-2010.
Please visit this thread for more information.
Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to ZTR for this post:
 
(login for full post details)
  #68 (permalink)
 eman 
Galveston ,TX
 
Experience: Intermediate
Platform: NT7
Broker: Zaner
Trading: Futures
 
Posts: 386 since Mar 2010
Thanks: 364 given, 433 received


dsraider View Post
aztrader9,

The post above talks about how to use different kinds of charts (tick, time, vol), which is beyond the scope of my programming knowledge. That might be the problem. Can you go into the code and comment out the second and third charts and try it again tomorrow? Also, what NT are you using? I built this in 6.5 and haven't personally tested it in 7. In fact, if anyone has done that successfully, please let me know.

Thanks,
Dave

what that means is: as long as you're using a data provider that gives you tick-data, you should have no problem switching between vol / tick / range / etc data-series.

cheers,
-e

Reply With Quote
The following user says Thank You to eman for this post:
 
(login for full post details)
  #69 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

eman,

Is your friend using a demo account? That does let you use everything but if you're using an actual live account, I don't 'think' you're able to use strats. Maybe I'm wrong. It's happened before. It'll probably happen again before I finish typing this note.

Dave

Reply With Quote
 
(login for full post details)
  #70 (permalink)
 eman 
Galveston ,TX
 
Experience: Intermediate
Platform: NT7
Broker: Zaner
Trading: Futures
 
Posts: 386 since Mar 2010
Thanks: 364 given, 433 received


dsraider View Post
eman,

Is your friend using a demo account? That does let you use everything but if you're using an actual live account, I don't 'think' you're able to use strats. Maybe I'm wrong. It's happened before. It'll probably happen again before I finish typing this note.

Dave

dave,

yes my buddy has a free/demo license for ninja and is using the sim101 account to test a strategy.

i have a live license and have been running a strategy on the sim101 account as well. the only difference is that i can create multiple sim accounts (sim101, sim102, sim103, etc.) since i have a live/paid license.

we're both using ninja7b14 right now.

cheers,
-e

Reply With Quote
The following user says Thank You to eman for this post:
 
(login for full post details)
  #71 (permalink)
 COTtrader 
Michigan, Jackson
 
Experience: Intermediate
Platform: NT and TS
Broker: NT Continuum
Trading: ES, CL
 
Posts: 857 since Jul 2009
Thanks: 389 given, 552 received

So, one is NOT allowed to use ATM strategies on a live account with a any broker?

Ken

Reply With Quote
 
(login for full post details)
  #72 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Hey COTtrader,

I meant that you have to use the paid version of ninja to use them, since the free live account won't work with them but then eman yelled at me and called me stupid.

Dave

Reply With Quote
 
(login for full post details)
  #73 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received

Let me share how I "tweaked" NJ.

First I used the free demo licence and set-up my charts and strategies using a sim account.

Then I changed the licence to my broker's one (which does not come with ATM and strategy running features) and opened a SuperDom to trade using my real account or sim account.

NJ cannot detect I was using 2 licences on one computer at the same time. I did it a few times early this year and seemed no conflict. Have stayed with the free demo licence after stopping trading real in early Feb.

Hope the above help.

Have a Great weekend.

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #74 (permalink)
 eman 
Galveston ,TX
 
Experience: Intermediate
Platform: NT7
Broker: Zaner
Trading: Futures
 
Posts: 386 since Mar 2010
Thanks: 364 given, 433 received


dsraider View Post
Hey COTtrader,

I meant that you have to use the paid version of ninja to use them, since the free live account won't work with them but then eman yelled at me and called me stupid.

Dave

lol...i didn't mean to yell at you.

enjoying this thread. thanks again for setting it up.

cheers,
-e

Reply With Quote
 
(login for full post details)
  #75 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Haha I'm just kidding. I was on about three hours sleep when I wrote that and everything seemed funny to me at the time.

Have a good night,
Dave

Reply With Quote
 
(login for full post details)
  #76 (permalink)
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 184 received


dsraider View Post
Good news/Bad news....

The good news is I fixed your trail. Please make the following changes to your code:

SetStopLoss("Long ", CalculationMode.Ticks, 15, false); should be
SetStopLoss("", CalculationMode.Ticks, 15, false);

Also, in the trail part, (not the BE part) use:
SetStopLoss(longEntryID, CalculationMode.Price, newPrice, false); and
SetStopLoss(shortEntryID, CalculationMode.Price, newPrice, false);
Dave


Dave and Beth,

Dave, I have tried using the base code you posted, and the alterations here, and the BE & TS
never seem to kick in. Do either of you have code that seems to work with all PT BE TS working on both the initial entry and also on the 'runner'?

If either of you do, I would really appreciate just that part of the code. Honestly, I hired on a programmer to accomplish that and no success (so far), which is obviously a disappointmnent.

Your assist is greatly appreciated.

Jon

Reply With Quote
 
(login for full post details)
  #77 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Hi Jon,

I'm at the office today and don't have NT here, so there's only so much I can do for now. Still, it will be hard to know what's wrong without seeing your entire strat. Can you either post or PM me whatever you can that isn't proprietary? I'm really not an advanced programmer but I'll see if there's anything I can do. Also, what does PT stand for? See? <---Not advanced

Dave

Reply With Quote
 
(login for full post details)
  #78 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received


dsraider View Post
what does PT stand for?

Hi Dave

PT stands for Profit Target I believe. Guess Jon will correct me if I'm wrong.

Hi Jon

Dave has been very helpful when I tried to resolve the BE/Trail myth. You're definitely in good hands. I posted a sample NJ strategy which I used and its BE/trail code worked for me. I will try to dig out the post shortly.

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #79 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received


Trader.Jon View Post
Do either of you have code that seems to work with all PT BE TS working on both the initial entry and also on the 'runner'?

Hi Jon

I can understand the frustration as I was in the same boat for weeks. I used the enclosed NJ sample strategy (which is a little simpler while Dave's one is too advanced for me) and it worked. Cory suggested a link in the following thread (Post #10 on page 1) and you may want to check it out as well:



Good luck!

Beth

Attached Files
Register to download File Type: cs ProfitTargetTrailingStop_1[1].01b.cs (7.9 KB, 108 views)
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #80 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Haha that makes sense. Oh man. I need sleep. Jon, let me know how you make out with Beth's suggestion. Beth, does this mean you're 100% up and running? Haven't heard from you for awhile.

Dave

Reply With Quote
 
(login for full post details)
  #81 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received


dsraider View Post
Beth, does this mean you're 100% up and running?

Hi Dave

Yes, my draft strategy with PT/BE/Trail code worked though it's not as profitable as the ones without BE/Trail. Oh, I have stopped my strategy production and testing for some weeks. Am now back to discretionary trading. Sim-trades have been mostly Green (19 Green days vs 1 Red day) and will do real trades very very soon .. smile ..

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #82 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

19:1???

Beth, that's great. Congratulations! I started reading your journal but ran out of time. Hoping to read the rest sooner rather than later.

Methinks you're ready to make some real money. Best of luck!

Dave

Reply With Quote
 
(login for full post details)
  #83 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received


dsraider View Post
19:1???

Thanks Dave. Now is 21:1 LOL! Smile ..

My current challenge is our Internet disconnection issue. There are certainly benefits living in a small eco city (Little Lake is within 10 feet directly across from our small house) and unfortunately Internet is not fully developed yet .. sigh .. Wish me luck!

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #84 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

No way!

Okay, I'll check with my Super and see if we have any open apartments in my building. You two okay with a 400 sq ft 1-bed in the middle of Manhattan? We can all go out for hot dogs.

Nice trading!

Dave

Reply With Quote
 
(login for full post details)
  #85 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
 
Posts: 1,773 since Dec 2009
Thanks: 1,258 given, 1,203 received


dsraider View Post
You two okay with a 400 sq ft 1-bed in the middle of Manhattan? We can all go out for hot dogs.

Your ideas sound great to me Dave! Do they have vegetarian hot dogs too?!

FYI: I tried "lightly" before IF Nelson (my lovely hubby) may consider moving to two other cities in the neighborhood (30-45 minutes drive from here) and not Toronto (where I used to reside). You may guess his answer .. sigh ..

Happy & Successful Trading!

Beth

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #86 (permalink)
 studio88 
Queensland, Australia
 
Experience: Intermediate
Platform: NinjaTrader, ProRealtime, Others
Broker: IB
 
Posts: 94 since May 2010
Thanks: 102 given, 47 received

Hi folks,

Thanks for posting dsraider and others whom contributed kindly.

Couple of Q's if you dont mind.

Does this strategy work on N7? and is this only for futures/forex or does it does it work well on stocks daily or intraday as well?

Thnx

Reply With Quote
 
(login for full post details)
  #87 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Hi Studio,

I believe it will physically work on NT 7 though I wrote it in NT 6.5 and haven't switched over yet, so maybe someone else can help with that. The 20/50 cross that I threw in there as an entry signal, though, was just for template purposes. So, yes, it will work on stocks, futures and forex but I don't know how well . The idea was always for people to be able to grab it and install their own indicator signals.

Hope that helps,
Dave

Reply With Quote
The following user says Thank You to dsraider for this post:
 
(login for full post details)
  #88 (permalink)
 gg80108 
Castle Pines N, CO.
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp Futures/Zen-Fire)
Trading: ES
 
Posts: 201 since Jul 2009
Thanks: 196 given, 130 received

Works good on NT7.... Did convert the IOrder part to IExecution,, since I was getting some rejected orders cause IOrder sometimes doesn't return the correct price. IF ur trading very small time frame fast markets with tight stops this could bite ya.

Reply With Quote
The following user says Thank You to gg80108 for this post:
 
(login for full post details)
  #89 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Thanks for that, gg. If and when I ever switch over, I'll be sure to check out IExecution.

Dave

Reply With Quote
 
(login for full post details)
  #90 (permalink)
 gg80108 
Castle Pines N, CO.
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp Futures/Zen-Fire)
Trading: ES
 
Posts: 201 since Jul 2009
Thanks: 196 given, 130 received

Have u seen this message on overfill attached,, it all of a sudden just cropped up.. Ninja support gave me some links and suggested to switch over to "unmanaged" order entry, which means keep track of everything yourself.. This seems kinda strange to me, If ninja knows that sometimes there code blows up and u loose money guess its only a game to them!!

Attached Thumbnails
Click image for larger version

Name:	overfill.PNG
Views:	99
Size:	14.1 KB
ID:	15685  
Reply With Quote
 
(login for full post details)
  #91 (permalink)
 aqawle 
Kansas City, Mo
 
Experience: Beginner
Platform: Ninjatrader
Broker: Zen-fire
Trading: ES, Oil
 
Posts: 19 since Mar 2010
Thanks: 1 given, 11 received

Hi MXASJ, I've downloaded this autotrader of yours and it is very intresting. I don't know how it takes trades, but I was wondering if you'd be kind enough to modify it so it uses the TSsupertrend indicator that is on the download section. I'm not a programmer but I'd have done it myself. Thanks in advance.

Reply With Quote
 
(login for full post details)
  #92 (permalink)
 dssilver 
New York, NY
 
Experience: Advanced
Platform: NinjaTrader IB
 
Posts: 2 since Jul 2010
Thanks: 0 given, 0 received

Brand new to NinjaTrader and looking for some sample strategy code. Very interested in looking at the posts from dsraider and MXASJ. The downloads contain .cs files. The Import NinjaScript function is looking for a "NinjaScript Archive File". So my newbie question is........how do I import a cs file into NT7?

Followup.......MXASJ says his code runs in NT7. Is dsraider's code compatible as well?

Thanks much.

Reply With Quote
 
(login for full post details)
  #93 (permalink)
 dssilver 
New York, NY
 
Experience: Advanced
Platform: NinjaTrader IB
 
Posts: 2 since Jul 2010
Thanks: 0 given, 0 received

Ok, I guess the RAR file that I downloaded IS a NinjaScript archive file. So I'm making things complicated by unzipping it myself.... Sorry.

Reply With Quote
 
(login for full post details)
  #94 (permalink)
dsraider
New York, NY
 
 
Posts: 142 since Dec 2009
Thanks: 41 given, 87 received

Another ds? There can be only one! Glad you got it figured out.

Dave

Reply With Quote
 
(login for full post details)
  #95 (permalink)
 gg80108 
Castle Pines N, CO.
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp Futures/Zen-Fire)
Trading: ES
 
Posts: 201 since Jul 2009
Thanks: 196 given, 130 received

If u just have a cs file u can copy it directly to the strategy or indicator director in Ninja.. U will then have to go in and edit and compile one of the script or indicatiors,, then the script and any errors will show up . Remember when u compile all scripts or indicators all compile,, so if an error shows up it may not be in the script u are compiling,, look carefully at the bottom errors to see which script its talking about..

Reply With Quote
 
(login for full post details)
  #96 (permalink)
 LostTrader 
Tucson, AZ
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Mirus/Zen-Fire
Trading: CL, TF
 
LostTrader's Avatar
 
Posts: 74 since Sep 2009
Thanks: 21 given, 64 received

I tried coding a strategy for the first time, and started with dsraider's sample (Thank you!!).
This uses some of that and roonius' TSSuperTrend v2.3 (which you must already have).
It is specifically written for NT 6.5 -- some things should be re-written if it were NT7 and I am not ready to go there yet. The reverse is klutzy because of NT 6.5 Internal Order handling.

Anyway just wanted to share to pay back some.

No guarantees of profitability! especially if you don't limit the times to trade...
Come to think of it, I've only tested it on a Range chart. LOL

OK, I figured out how to save the file in the Downloads section:

Reply With Quote
The following user says Thank You to LostTrader for this post:
 
(login for full post details)
  #97 (permalink)
 Ducman 
The Netherlands
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NINJATRADER Brokerage / Continuum
Trading: CL
 
Ducman's Avatar
 
Posts: 469 since Nov 2010
Thanks: 408 given, 637 received

Hello Dave,

I like your startegy set-up. It's a good learning tool. I don't seem to get it to do backtesting. I can using the standard build-in strategies but can't get it to work with this one. Do I overlook something?

Regards,

Ducman

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #98 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,068 since Jun 2009
Thanks: 32,534 given, 98,491 received


Ducman View Post
Hello Dave,

I like your startegy set-up. It's a good learning tool. I don't seem to get it to do backtesting. I can using the standard build-in strategies but can't get it to work with this one. Do I overlook something?

Regards,

Ducman

Hi, please be more specific "can't get it to work" so we can help.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #99 (permalink)
 Ducman 
The Netherlands
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NINJATRADER Brokerage / Continuum
Trading: CL
 
Ducman's Avatar
 
Posts: 469 since Nov 2010
Thanks: 408 given, 637 received

Mike,

When it runs the backtest it just doesn't give my any results. 0 trades and 0 profit. Using the same settings on a build in strategy or using the simulation mode works fine.

I just wonder if there are any special things to think about when performing backtesting.

Ducman

Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #100 (permalink)
 gg80108 
Castle Pines N, CO.
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp Futures/Zen-Fire)
Trading: ES
 
Posts: 201 since Jul 2009
Thanks: 196 given, 130 received

Was this NT6 or 7? Post the code with the instrument and time frame u are testing, or take some screen shots to show whats working for u and not, so we are all on the same page..

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Sample Advanced Automated Strategy v1.0


Last Updated on November 16, 2011


Upcoming Webinars and Events

NinjaTrader Indicator Challenge!

Ongoing

Journal Challenge w/$1,800 in prizes!

May 7

The Cold Hard Truth: Maybe I Am Not Good Enough w/Chris Gray @ Earn2Trade

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts