|
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.
The difference between getBaseEquity() and getEquity() |
wenchao35
|
Post subject: The difference between getBaseEquity() and getEquity() |
Post rating: 0
|
Posted: Wed 10 Apr, 2013, 04:22
|
|
User rating: 0
Joined: Sun 03 Mar, 2013, 15:45 Posts: 34 Location: China, guangdong
|
My code is here. public class MyEa implements IStrategy { @Configurable("MyLastEquity")public double MyLastEquity; public void onAccount(IAccount account) throws JFException { MyLastEquity = history.getEquity(); //***I don't know how to define getBaseEquity()***** if(MyLastEquity>0){ console.getOut().println("MyLastEquity"+MyLastEquity); } } }
|
|
|
|
 |
jlongo
|
 |
Post subject: Re: The difference between getBaseEquity() and getEquity() |
Post rating: 1
|
Posted: Wed 10 Apr, 2013, 10:26
|
|
User rating: 94
Joined: Mon 06 Feb, 2012, 12:22 Posts: 357 Location: Portugal, Castelo Branco
|
hi wenchao35: getBaseEquity() is part of IAccount interface. You need to get the value on IAccount // after class declaration:
private IContext myContext; private IAccount myAccount;
// inside onStart()
myContext = context;
//anywhere
myAccount = myContext.getAccount(); double myBaseEquitity = myAccount.getBaseEquity(); Trade well JL EDIT: corrected a misspelled error on .getBaseEquity() function call
|
|
|
|
 |
wenchao35
|
Post subject: Re: The difference between getBaseEquity() and getEquity() |
Post rating: 0
|
Posted: Wed 10 Apr, 2013, 10:53
|
|
User rating: 0
Joined: Sun 03 Mar, 2013, 15:45 Posts: 34 Location: China, guangdong
|
jlongo wrote: hi wenchao35: getBaseEquitity() is part of IAccount interface. You need to get the value on IAccount // after class declaration:
private IContext myContext; private IAccount myAccount;
// inside onStart()
myContext = context;
//anywhere
myAccount = myContext.getAccount(); double myBaseEquitity = myAccount.getBaseEquitity(); Trade well JL thanks a lot,jlongo~ thanks~
|
|
|
|
 |
wenchao35
|
Post subject: Re: The difference between getBaseEquity() and getEquity() |
Post rating: 0
|
Posted: Wed 10 Apr, 2013, 11:56
|
|
User rating: 0
Joined: Sun 03 Mar, 2013, 15:45 Posts: 34 Location: China, guangdong
|
jlongo wrote: hi wenchao35: getBaseEquitity() is part of IAccount interface. You need to get the value on IAccount // after class declaration:
private IContext myContext; private IAccount myAccount;
// inside onStart()
myContext = context;
//anywhere
myAccount = myContext.getAccount(); double myBaseEquitity = myAccount.getBaseEquitity(); Trade well JL I according to your method,but the code can't run... the message is "10:52:54 The method getBaseEquitity() is undefined for the type IAccount"
|
|
|
|
 |
jlongo
|
Post subject: Re: The difference between getBaseEquity() and getEquity() |
Post rating: 0
|
Posted: Wed 10 Apr, 2013, 13:35
|
|
User rating: 94
Joined: Mon 06 Feb, 2012, 12:22 Posts: 357 Location: Portugal, Castelo Branco
|
wenchao35: Other way: package myJForex.strategies.help;
import com.dukascopy.api.IAccount; import com.dukascopy.api.IBar; import com.dukascopy.api.IConsole; import com.dukascopy.api.IContext; import com.dukascopy.api.IEngine; import com.dukascopy.api.IHistory; import com.dukascopy.api.IIndicators; import com.dukascopy.api.IMessage; import com.dukascopy.api.IStrategy; import com.dukascopy.api.ITick; import com.dukascopy.api.Instrument; import com.dukascopy.api.JFException; import com.dukascopy.api.Period;
public class Equitity implements IStrategy{ // Base objects creation
private IContext myContext; private IHistory myHistory; private IConsole myConsole; private IIndicators myIndicators; private IAccount myAccount; private IEngine myEngine; private double myBaseEquitity;
@Override public void onStart(IContext context) throws JFException { myContext = context; myConsole = myContext.getConsole(); }
@Override public void onTick(Instrument instrument, ITick tick) throws JFException { }
@Override public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { }
@Override public void onMessage(IMessage message) throws JFException { }
@Override public void onAccount(IAccount account) throws JFException { myConsole.getOut().println(account.getBaseEquity()); }
@Override public void onStop() throws JFException { } }
Trade well JL
Attachments: |
Equitity.java [1.55 KiB]
Downloaded 357 times
|
Equitity.jfx [1.71 KiB]
Downloaded 308 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
API Support
|
Post subject: Re: The difference between getBaseEquity() and getEquity() |
Post rating: 0
|
Posted: Wed 10 Apr, 2013, 13:48
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
wenchao35
|
Post subject: Re: The difference between getBaseEquity() and getEquity() |
Post rating: 0
|
Posted: Wed 10 Apr, 2013, 14:01
|
|
User rating: 0
Joined: Sun 03 Mar, 2013, 15:45 Posts: 34 Location: China, guangdong
|
API Support wrote: why can't quote the code of "double getBaseEquity()"..WHY
|
|
|
|
 |
jlongo
|
Post subject: Re: The difference between getBaseEquity() and getEquity() |
Post rating: 1
|
Posted: Wed 10 Apr, 2013, 14:19
|
|
User rating: 94
Joined: Mon 06 Feb, 2012, 12:22 Posts: 357 Location: Portugal, Castelo Branco
|
Hi wenchao35: What java editor are you using ? There exist several possibilities for this to happen... Note: On my first post i make a mistake on the placed code as i write directly on the post. .getBaseEquitity() must be getBaseEquity()! Trade well JL Edit: if you use JForex editor, to me seems to work ok... 
Attachments: |
2013-04-10_1428.png [64.6 KiB]
Downloaded 576 times
|
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
|
|
|
|
|
 |
wenchao35
|
Post subject: Re: The difference between getBaseEquity() and getEquity() |
Post rating: 0
|
Posted: Wed 10 Apr, 2013, 15:21
|
|
User rating: 0
Joined: Sun 03 Mar, 2013, 15:45 Posts: 34 Location: China, guangdong
|
jlongo wrote: Hi wenchao35: What java editor are you using ? There exist several possibilities for this to happen... Note: On my first post i make a mistake on the placed code as i write directly on the post. .getBaseEquitity() must be getBaseEquity()! Trade well JL Edit: if you use JForex editor, to me seems to work ok...  Oh! I finally know where the problem is! I use the wrong code! "history" has no "getBaseEquity()" "account" has "getBaseEquity()" so MyEquity = history.getEquity(); //× MyEquity = account.getEquity(); //√
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|