Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Average Entries Line
 Post subject: Average Entries Line Post rating: 0   New post Posted: Wed 12 Jan, 2011, 12:38 

User rating: 1
Joined: Tue 11 Jan, 2011, 06:10
Posts: 6
Hi,

I was wondering if there is a way to get Jforex to display an accurate average entries line which will plot the BE point of more than one trade taken on any one chart?

You guys are doing great here by the way!

I really am starting to fall in love with Jforex, I just wish there was an easier way to load it up than through the Web...

Many thanks Jal


 
 Post subject: Re: Average Entries Line Post rating: 0   New post Posted: Wed 19 Jan, 2011, 10:05 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please elaborate the task.


 
 Post subject: Re: Average Entries Line Post rating: 0   New post Posted: Wed 19 Jan, 2011, 10:48 

User rating: 1
Joined: Tue 11 Jan, 2011, 06:10
Posts: 6
Hi,

Basically if I am short GJ 131.562 and then I place another order short 130.222... I would like a line to appear on the chart giving the midpoint between the two positions (or more) where if price moves over that line I will start losing money... so a average between positions line...

In effect you would get the same position on the chart if you merged the positions... however I may not want to do this all the time...

This line need to be applicable to all charts which have open positions on them...

Can this be done?

Thank you!


 
 Post subject: Re: Average Entries Line Post rating: 0   New post Posted: Tue 01 Feb, 2011, 14:55 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
You should do this from a strategy rather than from a custom indicator. Calculate the midpoint price and draw a horizontal line e.g.
double midpointPrice = ...;
IChart chart = context.getChart(Instrument.EURUSD);   
IChartObjectFactory factory = chart.getChartObjectFactory();   
IHorizontalLineChartObject hline = factory.createHorizontalLine("hline", midpointPrice);
hline.setColor(Color.RED);
chart.addToMainChartUnlocked(hline);


 
 Post subject: Re: Average Entries Line Post rating: 0   New post Posted: Wed 02 Feb, 2011, 09:05 

User rating: 1
Joined: Tue 11 Jan, 2011, 06:10
Posts: 6
Thanks!

but its not compiling... :?:


 
 Post subject: Re: Average Entries Line Post rating: 0   New post Posted: Wed 02 Feb, 2011, 09:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
Please make sure you add the appropriate import:
import java.awt.Color;
import com.dukascopy.api.drawings.IChartObjectFactory;
import com.dukascopy.api.drawings.IHorizontalLineChartObject;


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com