Set Profit and Loss Variables - NinjaTrader Programming | futures io social day trading
futures io futures trading


Set Profit and Loss Variables
Updated: Views / Replies:4,741 / 20
Created: by brightredmegaphone Attachments:5

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 5  
 
Thread Tools Search this Thread
 

Set Profit and Loss Variables

  #1 (permalink)
Elite Member
Brisbane, Australia
 
Futures Experience: Advanced
Platform: Ninja, MT4
Favorite Futures: FX
 
Posts: 31 since Sep 2010
Thanks: 2 given, 13 received

Set Profit and Loss Variables

hi
I currently run a simple automated strategy using MT4, and I want to try & replicate it in NT4, so that I can backtest and refine some of the variables. I'm having difficulty replicating the profit target in the condition builder (i'm don't have a developers mind Im afraid)

In a long position:
if the current bar is the trigger bar, I want to buy on the next bar if it breaks x pips above the trigger bar (complete)
I then want to establish a stop loss that initially is set below the trigger bar by x pips
I also want to establish a profit target based on the range of the trigger bar - say initially 100%
Stage 2 is then to split the order & take the first lot off after 100% of trigger bar is reached & x% after that

So far I have created the low & high of the trigger bar as user variables, but not sure how to apply these to the setstoploss and setprofittarget in the condition builder. If I can achieve this, I could then move onto Stage 2.

Any help at this stage gratefully received - even if someone says "go get a programmer to develop it"

Michael


Last edited by Big Mike; November 9th, 2010 at 10:14 PM. Reason: moved from indicators to nt programming
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: Ninja
Broker/Data: Mirus/Zen
Favorite Futures: Futures - bonds, currencies, index
 
Posts: 288 since Oct 2010
Thanks: 70 given, 267 received


I've never used the strat wizard, but I had a quick look at it. When you're on the window defining stops/targets, in the parameters box, next to 'values', on the right hand side there's a small box with some dots in it. Click that - it gives you access to user variables.

Reply With Quote
The following user says Thank You to Xeno for this post:
 
  #4 (permalink)
Elite Member
Brisbane, Australia
 
Futures Experience: Advanced
Platform: Ninja, MT4
Favorite Futures: FX
 
Posts: 31 since Sep 2010
Thanks: 2 given, 13 received

UPdate


Xeno View Post
I've never used the strat wizard, but I had a quick look at it. When you're on the window defining stops/targets, in the parameters box, next to 'values', on the right hand side there's a small box with some dots in it. Click that - it gives you access to user variables.

Thx Xeno: in the end I watched Mike's video & have started to attempt to modify that. The main difference is that i wanted to set targets based on %'s rather than just ticks, & then have entered on a stop order (next bar) rather than market order. I gave up on the % entry idea for now, as it seems a bit beyond me, but the rest seems okay, with a couple of exceptions:

Shorts: b/e doesn't move up after 1st lot, but does move up after 2nd
Longs: b/e does move up after 1st, but the 3rd lot doesn't move

I think, if they are doing different things, I have been staring at the screen a little too long. Not sure if anyone can have a quick look, I suspect it is something very obvious.

Thank you.

Attached Files
Register to download File Type: zip ThreeProfitStops.zip (5.1 KB, 45 views)
Reply With Quote
The following user says Thank You to brightredmegaphone for this post:
 
  #5 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: Ninja
Broker/Data: Mirus/Zen
Favorite Futures: Futures - bonds, currencies, index
 
Posts: 288 since Oct 2010
Thanks: 70 given, 267 received

I think doing a quick c# (and Ninja Script) tutorial would help. You have all sorts of stuff that is not quite right. Some that occur to me at first glance:

- you probably don't need to be declaring things like smav1 everywhere you assign them
- your three SetStopLoss lines do the same thing - they have the same parameters, just a different label (set TraceOrders = true in Initialize()) (same applies to enter short and long stop lines)
- in ManageOrders() your breakeven3 lines are executed regardless of position (long or short) because you've terminated the if with '}' after breakeven2. Your breakeven3 lines are surrounded by meaningless {} You need to look up how 'if' works.

Reply With Quote
The following user says Thank You to Xeno for this post:
 
  #6 (permalink)
Elite Member
Israel
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: pfg
Favorite Futures: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 206 received


brightredmegaphone View Post
Shorts: b/e doesn't move up after 1st lot, but does move up after 2nd
Longs: b/e does move up after 1st, but the 3rd lot doesn't move

Thank you.

Its wrong to code scaling into a strategy.

Wrong. Wrong. Wrong!!!!!!!!!!!

Baruch

Reply With Quote
 
  #7 (permalink)
Elite Member
Brisbane, Australia
 
Futures Experience: Advanced
Platform: Ninja, MT4
Favorite Futures: FX
 
Posts: 31 since Sep 2010
Thanks: 2 given, 13 received

I basically wanted to test a simple 3 profit/stop system using an on-stop order system that buys above market. The stops would move to b/e once the 1st lot had been achieved. I wanted this in 2 ways: - one based on fixed ticks (say, 20, 40, 60) & one based on percentages. Say 100, 200, 500% of previous bar ranges.

I have used this system manually on day trading swing charts for ages; I would have thought it was fairly easy to setup or that it had already been setup somewhere. It was the entire reason for me looking into NT, as if it could be setup in the condition builder I had enough nous (hopefully) to establish my own patterns, price action rules etc. I use very few indicators in my trading.

I have had various replies that I should set it up myself (don't have coding background with enough experience) or that it is too difficult to set up in condition builder, but I had thought it would have been developed somewhere. Maybe if I join Elite I might find it there?

Thanks for help.

Michael
BTW, not sure what last post was, something bout scaling & being wrong is this a reference to my trading or my coding?

Reply With Quote
 
  #8 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: Ninja
Broker/Data: Mirus/Zen
Favorite Futures: Futures - bonds, currencies, index
 
Posts: 288 since Oct 2010
Thanks: 70 given, 267 received

Hi Michael,

I think it's unlikely it exists in the elite section, but you should probably still join up ;-)

The reason it probably doesn't exist is that it's a very simple strategy, that probably won't make money. You say you've used it manually for ages. Does it make money consistently? Can you honestly say that you've followed the rules you intend to code 100% accurately, with no discretion? Are the levels going to be fixed, or are you changing them every day based on some clever analytics (which could then make your system profitable)

Sorry to be rather negative, but people who have coded and tested lots of systems would probably tell you a similar thing.

(regarding the scaling post - I think he means you shouldn't code a strategy that does scaling - i.e scaling into and out of positions. Personally I don't see why you shouldn't, I'd be interested to know why he thinks that)

Reply With Quote
 
  #9 (permalink)
Elite Member
Brisbane, Australia
 
Futures Experience: Advanced
Platform: Ninja, MT4
Favorite Futures: FX
 
Posts: 31 since Sep 2010
Thanks: 2 given, 13 received

hi Xeno

All I'm after is a modified version of what is already here on this site:
https://futures.io/beginners-introductions-tutorials/2512-video-tutorial-how-create-advanced-ninjatrader-strategy.html.

Instead of fixed size tick, I wanted %'s of previous ranges & I wanted to buy above market onstop, rather than just entry order. It was really just the entry/exit strategy around which I would create my own price action strategies. I've been running a hedge fund around such things for years, just really wanted to see if some of my systems could be automated.

Thanks for your input, I'm sure a man of your calibre could knock it up in 5 mins

Reply With Quote
 
  #10 (permalink)
Elite Member
Brisbane, Australia
 
Futures Experience: Advanced
Platform: Ninja, MT4
Favorite Futures: FX
 
Posts: 31 since Sep 2010
Thanks: 2 given, 13 received

Butcher not the block


hey Mike
Wondered if you read this whether you could comment; I've developed a simple strategy using your video as the backbone - 3 simple take profits with a simple feature. I'm not worried about profitability here, I'm worried about the tendency, seemingly randomly, for the code to work & then not.

The stop is supposed to move to b/e once targets are hit, which most of the time it seems to accomplish. There are however certain times when for no apparent reason, it doesn't do as it should. So far, Ninja Support haven't been too helpful so I thought as the title suggests, I would go to the butcher and not the block.

Thanks for any help.

Michael

Attached Files
Register to download File Type: zip GAPbounce3profitlong.zip (3.6 KB, 19 views)
Reply With Quote

Reply



futures io > > > > > Set Profit and Loss Variables

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
EasyLanguage Daily Profit and Daily Loss limit in strategy Big Mike EasyLanguage Programming 11 May 12th, 2016 02:50 PM
global variables: anyone got a complete NT7 example? elbone NinjaTrader Programming 2 July 19th, 2011 10:13 AM
How to set up a Stop (Limit) Loss order - Ninja Trader jdumanic NinjaTrader 2 June 7th, 2011 06:40 PM
Exposing variables kaywai NinjaTrader Programming 4 April 14th, 2011 12:58 PM
Working on profit-loss ratio cclsys NinjaTrader Programming 39 December 1st, 2009 11:32 PM


All times are GMT -4. The time now is 05:49 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2017-12-17 in 0.13 seconds with 20 queries on phoenix via your IP 54.82.81.154