ChartTrader: Programmatically changing selected Account - NinjaTrader Programming | futures io social day trading
futures io futures trading


ChartTrader: Programmatically changing selected Account
Updated: Views / Replies:1,048 / 5
Created: by vantojo 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
 

ChartTrader: Programmatically changing selected Account

  #1 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

ChartTrader: Programmatically changing selected Account

One of you more advanced guys might know how to do this...??

I'm making a global button on ChartTrader that will reset all my charts from Live back to SIM...so before I walk away from the charts, everything is on SIM when I get back.

Almost there, but when I use code to change the selected account from Live to SIM, the selected Account is changed on ChartTrader, but the mother code (Ninja) does not see it.... for example, when Ninja does not change the ChartTrader background to dark gray and it will still submit trades to the Live account even though the code changed the selected Account to Sim101.

Probably just a matter of triggering the right event, but actually I'm not sure how to get there....

Here is the code:

System.Windows.Forms.ComboBox CBAccount = null;

CBAccount = ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"] as System.Windows.Forms.ComboBox;

CBAccount.SelectedIndex = 1; // live account is 0, Sim101 is 1

// CBAccount.SelectedIndex = CBAccount.Items.IndexOf("Sim101"); // this does not work, it returns -1

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)
Just a boy
Auckland, New Zealand
 
Futures Experience: Beginner
Platform: Sierra Chart
Broker/Data: AMP/CQG
Favorite Futures: Whatever moves in my timezone
 
Posts: 1,803 since Sep 2009
Thanks: 3,165 given, 1,372 received

vvMiniTradePanel


Have a look at the code in @vvhg indi in this thread:

https://futures.io/elite-circle/25431-vvminitradepanel.html#post294586

This indi allows you to select to change the account and it changes it in Chart Trader and elsewhere at the sametime.

I actually use this indi for the purpose you describe - to move seemlessly from Live to SIM.

Reply With Quote
The following user says Thank You to steve2222 for this post:
 
  #4 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

Thank you!

What a tremendous resource we have here at futures.io (formerly BMT)!

Will dig into the code as you suggested. I'm not a native C# guy...but can do quite a bit with examples from others.

Reply With Quote
 
  #5 (permalink)
Elite Member
Neuquen, Argentina
 
Futures Experience: Intermediate
Platform: Ninja
Favorite Futures: CL, TF, 6S, NG, sometimes GC
 
Posts: 195 since Jul 2012
Thanks: 25 given, 39 received

works!

OK, taken from the indicator you mentioned, the code that will do this is:

using System.Runtime.InteropServices;

------------------------------------------------------------------------------------------------------------

[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);

--------------------------------------------------------------------------------------------------------------

CBAccount = ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"] as System.Windows.Forms.ComboBox;

// to select the prior account in the list
SendMessage(CBAccount.Handle, 0x0100, (IntPtr)0x26, (IntPtr)0X1500001); //uparrow keydown

// to select the next account in the list
SendMessage(CBAccount.Handle, 0x0100, (IntPtr)0X28, (IntPtr)0X1500001); //downarrow keydown

--------------------------------------------------------------------------------------------------------------

works OK for me because I only have SIM and my production account in the ChartTrader account list when Live...if there are more than two accounts it would create need for more code

------------------------------------------------------------------------------------------------------------------------

THANK YOU vvhg and steve2222 !!

Reply With Quote
The following user says Thank You to vantojo for this post:
 
  #6 (permalink)
Trading Apprentice
Russia
 
Futures Experience: Beginner
Platform: Laser
Favorite Futures: Stocks
 
Posts: 2 since Nov 2013
Thanks: 0 given, 0 received


vantojo View Post

Here is the code:

System.Windows.Forms.ComboBox CBAccount = null;

CBAccount = ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"] as System.Windows.Forms.ComboBox;

CBAccount.SelectedIndex = 1; // live account is 0, Sim101 is 1

// CBAccount.SelectedIndex = CBAccount.Items.IndexOf("Sim101"); // this does not work, it returns -1

private Account selectedacct;
private ComboBox ctrdrAcct;

ctrdrAcct = (ComboBox)ChartControl.Controls["pnlChartTrader"].Controls["ctrChartTraderControl"].Controls["cboAccount"];
selectedacct = (Account) ctrdrAcct.SelectedItem; // this you Account

Reply With Quote

Reply



futures io > > > > > ChartTrader: Programmatically changing selected Account

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
Indicator to Plot the OHLC - user selected start/stop times rfiske NinjaTrader Programming 105 October 14th, 2015 11:14 AM
Is it possible to programmatically pause NinjaTrader Market Replay? drunkcolonel NinjaTrader 4 May 5th, 2014 10:58 PM
ChartTrader -- How to get the selected ATM with script vantojo NinjaTrader Programming 6 March 14th, 2013 11:05 AM
Accessing selected manually drawn chart drawing tag Xav1029 NinjaTrader Programming 14 October 7th, 2012 08:41 AM
Automation for the programmatically impaired trader trendisyourfriend Elite Automated NinjaTrader Trading 3 August 19th, 2012 09:12 PM


All times are GMT -4. The time now is 06:50 PM.

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-16 in 0.09 seconds with 19 queries on phoenix via your IP 54.145.16.43