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,750 / 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

  #11 (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

Saying it doesn't do as it should doesn't help much. We need to know exactly what it does and doesn't do.

It'll help greatly if you get into the habit of putting Prints in your code while developing. I suggest you put a load of Prints in, printing out various variables to see their value. You should also put the line

 
Code
TraceOrders = true;
in your Initialize method, then you will see what stops, targets and entries are being generated. Then, after you've looked at the output in the output window, if you can't figure it out, post the output and the code here.

Reply With Quote
 
  #12 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,355 given, 83,237 received

Xeno has good advice. I can't really help much, I stopped using Ninja a while back.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

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



Xeno View Post
Saying it doesn't do as it should doesn't help much. We need to know exactly what it does and doesn't do.

It'll help greatly if you get into the habit of putting Prints in your code while developing. I suggest you put a load of Prints in, printing out various variables to see their value. You should also put the line

 
Code
TraceOrders = true;
in your Initialize method, then you will see what stops, targets and entries are being generated. Then, after you've looked at the output in the output window, if you can't figure it out, post the output and the code here.

Thx for this Xeno. I've attached 2 jpegs from the same chart, same code etc. In 1, the code works fine; 3 longs are executed, , lots 1 & 2 reach targets & the stoploss moves up accordingly and is eventually hit.

In the other eg, same thing - 3 lots entered long (correct) 1st target hit, then it seems only the 2nd lot moves to b/e, the 3rd remains & is hit as an original stop loss. What I am trying to achieve is that 3 lots are entered, once 1st lot hits target, remaining 2 stop losses move up to b/e. Then, as 2nd target is achieved, the 3rd lot remains @ b/e still & does not move.

I am quite close & have set trace=true as you suggested. I am missing something obvious I think.

Thx for your responses so far.

Michael

Attached Thumbnails
Set Profit and Loss Variables-gapbounce-1.jpg   Set Profit and Loss Variables-gapbounce-2.jpg  
Reply With Quote
 
  #14 (permalink)
Elite Member
Brisbane, Australia
 
Futures Experience: Advanced
Platform: Ninja, MT4
Favorite Futures: FX
 
Posts: 31 since Sep 2010
Thanks: 2 given, 13 received

Script

Sorry this is the new script, I did do a bit of work on it today; nearly there.

Attached Files
Register to download File Type: zip GAPbounce3profitlong.zip (3.7 KB, 19 views)
Reply With Quote
 
  #15 (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

What's happened to your {} around your if blocks in ManageOrders? Where are the prints and output I suggested?

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


Xeno View Post
What's happened to your {} around your if blocks in ManageOrders? Where are the prints and output I suggested?

I re-read your post & took the quotes out of ManageOrders, that's what you said and it seemed to help.'Obviously I missed something.

Wasn't sure where to put Print/Outputs or even to look for them. Sorry if I'm a bit slow but coding is a bit new to me. Bit of cut 'n paste really.

See you're from London, you'd be enjoying the Ashes then.

Reply With Quote
 
  #17 (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

Yes, I'm loving the Ashes. Thanks.

You need to do that c# tutorial I mentioned. For example, C# Station: C# Tutorial Lesson 03 - Control Statements - Selection

Seriously, the time you put in to work out how to use 'if' and {} and other basic constructs will be invaluable. You can't really program without that knowledge. You can come on here and keep asking, but ultimately it'll get frustrating.

Print statements are simple.

Try, for example, lots of lines like this -

 
Code
Print(Time[0]+" Moving stop target 2 to b/e");
Then bring up an output window (Alt-O) and run. Once you see how powerful Print is for debugging your code you'll never look back.

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

Thx, Xeno I'll have a look. I'm not sure how much programming I really want to do we shall see. I currently run a fund that uses MT4 servers; I just jumped into NT to have a look as I thought I could test some of my own ideas. The jury is still out for the moment. I tend to focus more on the ideas rather than the complete implementation.

In the meantime, if you feel so inclined can you see any obvious errors that might clear up this problem; scaling out of orders is a fairly standard method & I think it is nearly correct. Appreciate the assistance it has taken a while to get there.

BTW, don't expect Australia to improve much in this series, I don't think anyone is expecting them too here.

Michael

Reply With Quote
 
  #19 (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

Well, I already told you that not having {} after your ifs is probably not want you want. I don't see anything else obvious, but us programmers tend to use prints. Computers are so much better at running code than your head.

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


Thx Xeno, finally got it to work.

I did enter in some print outputs, where do I find those?

Appreciate the patience.

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 01:22 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-18 in 0.13 seconds with 20 queries on phoenix via your IP 54.92.201.232