How to get CumProfit of the day, not the whole chart? - NinjaTrader Programming | futures io social day trading
futures io futures trading


How to get CumProfit of the day, not the whole chart?
Updated: Views / Replies:2,601 / 6
Created: by gztanwei Attachments:0

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
 
Thread Tools Search this Thread
 

How to get CumProfit of the day, not the whole chart?

  #1 (permalink)
Elite Member
toronto
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 33 since Sep 2009
Thanks: 3 given, 10 received

How to get CumProfit of the day, not the whole chart?

Hi I am trying to set a daily profit and loss limit to my strategy. After the limit is hit, the strategy stops trading for the day.

Here I found this function to return cumulative realized profit.
Performance.AllTrades.TradesPerformance.Points.Cum Profit

But this function returns cumulated profit of all days on the chart, not daily profit...

I know I could work around it by setting the chart's data series to one day only. But I would really to have daily profit limit, so that I can eye on my strategy on a multiple-day chart.

Thank you!

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
Milan (I)
 
Futures Experience: Advanced
Platform: Ninjatrader
Broker/Data: Kinetick
Favorite Futures: FDAX,6E,CL,YM,NQ,ES
 
redratsal's Avatar
 
Posts: 1,653 since Oct 2010
Thanks: 1,217 given, 2,067 received


try this: Performance.RealtimeTrades.TradesPerformance.Currency.CumProfit

** if you stop your strategy and restart it the same day the daily cumprofit will restart from zero.

Reply With Quote
 
  #4 (permalink)
Elite Member
toronto
 
Futures Experience: Beginner
Platform: NinjaTrader
 
Posts: 33 since Sep 2009
Thanks: 3 given, 10 received


redratsal View Post
try this: Performance.RealtimeTrades.TradesPerformance.Currency.CumProfit

** if you stop your strategy and restart it the same day the daily cumprofit will restart from zero.

thanks. but this method does not work when I want to back test my strategy... I hope the strategy to stop every day on my chart, and start again the next day.

Reply With Quote
 
  #5 (permalink)
Elite Member
Milan (I)
 
Futures Experience: Advanced
Platform: Ninjatrader
Broker/Data: Kinetick
Favorite Futures: FDAX,6E,CL,YM,NQ,ES
 
redratsal's Avatar
 
Posts: 1,653 since Oct 2010
Thanks: 1,217 given, 2,067 received


gztanwei View Post
thanks. but this method does not work when I want to back test my strategy... I hope the strategy to stop every day on my chart, and start again the next day.

Ok you did not mention in your op it was for backtesting concern, if the data range is consistent what I do in this case is import the data into an excel file and filter the information separately (nt has some limits and sometimes you have to overcome manually).

Reply With Quote
 
  #6 (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,238 since Jun 2009
Thanks: 29,350 given, 83,221 received

Been years, so I am rusty. But I have definitely done this for both real time and backtesting.

There is another method you can call that is not RealtimeTrades. Can't remember what it is called, sorry.

And then on each new session, you need to simply check the prior value, and then 'reset' it by putting forward a new value that starts at zero each day.

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
 
  #7 (permalink)
Elite Member
Milan (I)
 
Futures Experience: Advanced
Platform: Ninjatrader
Broker/Data: Kinetick
Favorite Futures: FDAX,6E,CL,YM,NQ,ES
 
redratsal's Avatar
 
Posts: 1,653 since Oct 2010
Thanks: 1,217 given, 2,067 received

 
Code
 protected override void OnBarUpdate()
        
			// At the start of a new session
			if (Bars.FirstBarOfSession)
			{
				// Store the strategy's prior cumulated realized profit and number of trades
				priorTradesCount = Performance.AllTrades.Count;
				priorTradesCumProfit = Performance.AllTrades.TradesPerformance.Currency.CumProfit;
				
				/* NOTE: Using .AllTrades will include both historical virtual trades as well as real-time trades.
				If you want to only count profits from real-time trades please use .RealtimeTrades. */
			}
			
			/* Prevents further trading if the current session's realized profit exceeds $1000 or if realized losses exceed $400.
			Also prevent trading if 10 trades have already been made in this session. */
			if (Performance.AllTrades.TradesPerformance.Currency.CumProfit - priorTradesCumProfit >= 1000
				|| Performance.AllTrades.TradesPerformance.Currency.CumProfit - priorTradesCumProfit <= -400
				|| Performance.AllTrades.Count - priorTradesCount > 10)
			{
				/* TIP FOR EXPERIENCED CODERS: This only prevents trade logic in the context of the OnBarUpdate() method. If you are utilizing
				other methods like OnOrderUpdate() or OnMarketData() you will need to insert this code segment there as well. */
				
				// Returns out of the OnBarUpdate() method. This prevents any further evaluation of trade logic in the OnBarUpdate() method.
				return;
			}

Reply With Quote
The following 5 users say Thank You to redratsal for this post:

Reply



futures io > > > > > How to get CumProfit of the day, not the whole chart?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Historical intra-day futures chart pre 1997? ElectricWiz Emini Index Futures Trading 2 May 13th, 2012 02:49 AM
More than 1 day in replay chart vecchp NinjaTrader 4 September 17th, 2011 04:03 AM
Stop strategy after a set $ amount lost from CumProfit vast NinjaTrader Programming 21 November 15th, 2010 05:24 PM
chart gallery for a slow day cory Off-Topic 0 January 13th, 2010 03:50 PM
Previous Day OHLC for Range Chart? essiar NinjaTrader 2 October 15th, 2009 11:28 AM


All times are GMT -4. The time now is 07:26 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-13 in 0.09 seconds with 19 queries on phoenix via your IP 54.196.182.102