Set Profit and Loss Variables - futures io
futures io futures trading



Set Profit and Loss Variables


Discussion in NinjaTrader

Updated by Xeno
      Top Posters
    1. looks_one brightredmegaphone with 11 posts (1 thanks)
    2. looks_two Xeno with 8 posts (2 thanks)
    3. looks_3 Big Mike with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 6,528 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 20 replies
    2. attach_file 5 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,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
 

Set Profit and Loss Variables

(login for full post details)
  #1 (permalink)
Brisbane, Australia
 
Experience: Advanced
Platform: Ninja, MT4
Trading: FX
 
Posts: 31 since Sep 2010
Thanks: 2 given, 13 received

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

Reply With Quote

Can you help answer these questions
from other members on futures io?
Degiro Negative Balance Advice
Traders Hideout
3x Fangdango
Traders Hideout
I have segregated my investment and trading
Psychology and Money Management
NinjaTrader Applications Rejected
Brokers
Thinkscript for scanning in Option Hacker
ThinkOrSwim
 
Best Threads (Most Thanked)
in the last 7 days on futures io
VWAP for stock index futures trading?
54 thanks
Coronavirus COVID-19
19 thanks
Price Action Kewltech Style
15 thanks
The CL Crude-analysis Thread
9 thanks
Bitten by FOMC
8 thanks
 
(login for full post details)
  #3 (permalink)
UK
 
Experience: Intermediate
Platform: Ninja
Broker: Mirus/Zen
Trading: Futures - bonds, currencies, index
 
Posts: 288 since Oct 2010
Thanks: 70 given, 268 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:
 
(login for full post details)
  #4 (permalink)
Brisbane, Australia
 
Experience: Advanced
Platform: Ninja, MT4
Trading: FX
 
Posts: 31 since Sep 2010
Thanks: 2 given, 13 received


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, 51 views)
Reply With Quote
The following user says Thank You to brightredmegaphone for this post:
 
(login for full post details)
  #5 (permalink)
UK
 
Experience: Intermediate
Platform: Ninja
Broker: Mirus/Zen
Trading: Futures - bonds, currencies, index
 
Posts: 288 since Oct 2010
Thanks: 70 given, 268 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:
 
(login for full post details)
  #6 (permalink)
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
 
Posts: 323 since Jun 2009
Thanks: 6 given, 207 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
 
(login for full post details)
  #7 (permalink)
Brisbane, Australia
 
Experience: Advanced
Platform: Ninja, MT4
Trading: 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
 
(login for full post details)
  #8 (permalink)
UK
 
Experience: Intermediate
Platform: Ninja
Broker: Mirus/Zen
Trading: Futures - bonds, currencies, index
 
Posts: 288 since Oct 2010
Thanks: 70 given, 268 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
 
(login for full post details)
  #9 (permalink)
Brisbane, Australia
 
Experience: Advanced
Platform: Ninja, MT4
Trading: 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:
.

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
 
(login for full post details)
  #10 (permalink)
Brisbane, Australia
 
Experience: Advanced
Platform: Ninja, MT4
Trading: FX
 
Posts: 31 since Sep 2010
Thanks: 2 given, 13 received


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, 20 views)
Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Set Profit and Loss Variables


December 10, 2010


Upcoming Webinars and Events
 

An Afternoon With futures io member TropicalTrader

Elite only
     



Copyright © 2020 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