NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 09-17-2010, 07:11 PM   #1
Kontrol
Junior Member
 
Join Date: Sep 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default Trend following

Hi everyone, I'm new here.

I searched for a strategy here to do what I would like to do but I couldn't find it.

I'm a discretionary trader(more than 4 years) and I want to incorporate a part of my discretionary trading plan towards a more systematic plan.

I will start by saying that I have zero experience at programming but I hope that I will be able to build what I want with the help of Strategy Wizard.

I would like to know if it's possible to use "Condition Builder" to make this condition:

Let's say I open a long position on Eur/Usd with a size of 100 at 1.2500 then if the price will go to 1.2600 (100 pips move) then open another long position with a size of another 100, now I'm long 200 (so, basically what i want to do, is to open more positions IF the price is going in my favor. ----- While on the other hand, if the first position was filled and then the price was starting to go lower, then the that long position was liquidated at 1.2300(200 pips below).

It is possible to make this type of rules on Strategy Wizard?

Thank you. Sry for my english.
Kontrol is offline  
Reply With Quote
Old 09-18-2010, 09:37 AM   #2
Baruch
Senior Member
 
Join Date: Mar 2009
Posts: 442
Thanks: 0
Thanked 25 times in 16 posts
Default

Hi Kontrol,
I have no idea if it can be done with the Wizard (never used it), but don't do it. Just make two strategies and see the results.

Baruch
Baruch is offline  
Reply With Quote
Old 09-18-2010, 11:33 AM   #3
Kontrol
Junior Member
 
Join Date: Sep 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Baruch,
Thanks for your respons.

I think that the option for using two strategies is what I also wanted to choose but I'm not very sure from where to start. I'm very new into this field "programming".

Can anyone please help me on Strategy Wizard to create a condition like: "if price rise 0.50% (half of a percent) then... true" and when that will be "true" then in the "Do the following" i will write the command to open a long position.

Can please someone point me in the right direction? Thanks.
Kontrol is offline  
Reply With Quote
Old 09-18-2010, 12:23 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

You need to use two Sets.

Set 1's Condition Builder
Left: Price > Close of current bar (bars ago = 0)
Right: Price > Close of previous bar (bars ago = 1), Offset = Percentage, Offset value = 0.005
Middle: >=

Action: Misc > Set user defined variable > Variable0 = 1

Set 2's Condition Builder
Left: Variable0
Right: 0
Middle: ==
Action: Misc > Set user defined variable > Variable0 = 0
Action: Order management > Enter long position
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-18-2010, 03:25 PM   #5
Kontrol
Junior Member
 
Join Date: Sep 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi Josh,

Thank you for your help.

1.
I didn't figured it out, I mean, I built the conditions but when I test it in Market Replay, the strategy doesn't work as it should. It opens positions at random prices.

Please take a look to see if I wrote it right. Chart 1 and chart 2.

On Chart 3, is how I would like to make it work:

For example, let's say that I opened the automatic strategy at point 1 and the price is 1.2975.
(For this example I would not use the 0.50% , instead I will use a 25 pips move). And then the price is at 1.3000, here(point 2), the strategy should open first position(let's say quantity 100), then if the price rise further, then at 1.3025(point 3), the strategy should open another 100.

And then, if the price go back to 1.2975(point 4), the strategy should close the position opened at Point 3 (should close the 100 position opened at 1.3025)


2.
And also, I would want that the strategy open/or close the position when the price cross this levels, not when it will close the current bar. For this issue, it is ok if I will un-check the "Calculate on bar close" ?

Thank you.
Attached Images
File Type: png Set 1.png (39.7 KB, 13 views)
File Type: png Set 2.png (43.5 KB, 12 views)
File Type: png plan.png (35.2 KB, 15 views)
Last edited by Kontrol; 09-18-2010 at 03:27 PM.
Kontrol is offline  
Reply With Quote
Old 09-18-2010, 08:39 PM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Kontrol,

Your second set doesn't make sense (pardon the typo in my original post). You have Variable0 equal to 0 as the condition. Instead you should have Variable0 checked against the value of 1.

If you want the price to cross a certain price level you just have to tell it to be that certain price level instead of the previous bar in Set 1. On the right hand side just select numeric value and punch in the price level you want.

You can use Calculate On Bar Close = false if you want.
NinjaTrader_Josh is offline  
Reply With Quote
Old 09-20-2010, 04:19 PM   #7
Kontrol
Junior Member
 
Join Date: Sep 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default

ok, I will see what I will do.

Thanks Josh.
Kontrol is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TTM Trend astrolobe Indicator Development 2 03-31-2009 02:45 PM
TTm Trend Sidhartha Indicator Development 19 02-25-2009 06:06 AM
negligible trend? Burga1 Miscellaneous Support 0 08-02-2008 04:06 PM
Trend backcolor raz0rback Indicator Development 1 06-23-2008 05:06 AM
Trend line channels - Oscillator trend lines ? fryguy General Programming 1 05-16-2008 10:20 AM


All times are GMT -6. The time now is 07:21 AM.