Converting y to price with TS - EasyLanguage Programming | futures io social day trading
futures io futures trading


Converting y to price with TS
Updated: Views / Replies:1,123 / 5
Created: by onnb 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
 

Converting y to price with TS

  #1 (permalink)
Onn
Vancouver, Canada
 
Futures Experience: Intermediate
Platform: NinjaTrader, SierraCharts, thinkorswim
Favorite Futures: Stocks
 
Posts: 10 since Sep 2011
Thanks: 0 given, 2 received

Converting y to price with TS

Hi all, I am writing a TS program that responds to mouse clicks. I need to know the price at which the user clicked the price chart. I have the code that responds to mouse clicks. It generally receives the x/y coordinates and those need to be translated to price.

The code below almost works. The problem is that the clientWindow.Height includes the height of the main price sub graph as well as any other panels I have on (MACD or what not). I need to access the height of the main price panel or perhaps someone has anothe approach as to how to convert y coordinates to price?

 
Code
Using elsystem;
Using elsystem.collections;
Using elsystem.xml;
Using elsystem.io;
Using elsystem.windows.forms;
Using elsystem.drawing;
Using tsdata.common;
Using tsdata.trading;
Using platform;
Using charting;


Vars:
ChartingHost ch(NULL), price(0);

// Method called on AnalysisTechnique Initialized event.
// The sender parameter identifies the object that fires the event.
// The args parameter contains additional information about the event.
// NOTE:  Do not modify the method name, return type, or input parameters.

Method void AnalysisTechnique_Initialized( elsystem.Object sender, elsystem.InitializedEventArgs args ) 
begin
	{ Insert your EasyLanguage statements below }
	Print("AnalysisTechnique_Initialized");
	ch = ChartingHost.Create();
	
	ch.ChartElementClick += ChartingHost1_ChartElementClick;
end;



Method double ConvertYToPrice(int y)
Var: double highDisplay, double lowDisplay, double chartscale, double percentage, double clickPrice;
Begin
	highDisplay = Getappinfo(Aihighestdispvalue);
	lowDisplay = Getappinfo(Ailowestdispvalue);
	
	percentage = y / ch.ClientWindow.Height;
	clickPrice = highDisplay - (highDisplay - lowDisplay) * percentage;
	
        // next, round to tick size	

	Return 0;

end;


Method void ChartingHost1_ChartElementClick( elsystem.Object sender, charting.ChartElementClickEventArgs args )
begin
	If (args.Button  = MouseButton.Right) then
		Return;
	
	price  = ConvertYToPrice(args.Y);
			
end;

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)
Onn
Vancouver, Canada
 
Futures Experience: Intermediate
Platform: NinjaTrader, SierraCharts, thinkorswim
Favorite Futures: Stocks
 
Posts: 10 since Sep 2011
Thanks: 0 given, 2 received


For anyone interested, I think I found the solution....

elsystem.InitializedEventArgs args has an attribute called DataStreamValue which returns the price on which the user clicked.

so it looks like: args.DataStreamValue

You can test that the price is between Getappinfo(Aihighestdispvalue); and Getappinfo(Ailowestdispvalue); and determine that the user clicked on the price chart and not on some other panel.

Onn

Reply With Quote
The following user says Thank You to onnb for this post:
 
  #4 (permalink)
Elite Member
AUSTIN, TX
 
Futures Experience: Advanced
Platform: Thinkorswim
Favorite Futures: stocks
 
Posts: 4 since Nov 2012
Thanks: 0 given, 0 received

I can not make it work

Anybody knows how to make this code work?

Reply With Quote
 
  #5 (permalink)
Market Wizard
Hamburg Germany
 
Futures Experience: Advanced
Platform: Multicharts, Tradestation, Multicharts.NET, NinjaTrader, MetaTrader
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 1,533 since Apr 2013
Thanks: 231 given, 854 received
Forum Reputation: Legendary

forward2012,

can you elaborate what exactly is not working for you? I suspect that you need to include the solution @onnb pointed out in his second post for the code to work.

Regards,
ABCTG

Reply With Quote
 
  #6 (permalink)
Elite Member
AUSTIN, TX
 
Futures Experience: Advanced
Platform: Thinkorswim
Favorite Futures: stocks
 
Posts: 4 since Nov 2012
Thanks: 0 given, 0 received

I took the code and attempted to run it. Nothing is happening. I was hoping it will show me the price on the chart or log, nope. I want to to get the price after I click on the chart, with that price I wanted to buy or sell a security. That is what I am attempting to do. If you know, it will be great show me some example or sample code.

Reply With Quote

Reply



futures io > > > > > Converting y to price with TS

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
Converting Indicator to Strategy help! MXASJ NinjaTrader Programming 12 September 1st, 2014 02:42 PM
Converting EasyLanguage to C# christof21 Platforms and Indicators 5 December 9th, 2013 08:31 PM
converting indicator ness1g NinjaTrader 1 October 14th, 2013 02:29 PM
Help converting old EL to MC olobay MultiCharts 4 July 7th, 2012 10:33 PM
Converting code Jbird10 EasyLanguage Programming 3 December 22nd, 2011 09:04 PM


All times are GMT -4. The time now is 06:53 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-14 in 0.09 seconds with 19 queries on phoenix via your IP 54.226.227.175