|
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.
leverage alert |
helenaExpert
|
Post subject: leverage alert |
Post rating: 0
|
Posted: Mon 16 Apr, 2012, 23:37
|
|
User rating: 0
Joined: Tue 07 Feb, 2012, 19:18 Posts: 7 Location: Serbia, Belgrade
|
Hi,
I would like to setup alerts on leverage change
|
|
|
|
 |
API Support
|
 |
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Tue 17 Apr, 2012, 11:26
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Do you mean leverage or "use of leverage"?
|
|
|
|
 |
helenaExpert
|
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Tue 01 May, 2012, 22:24
|
|
User rating: 0
Joined: Tue 07 Feb, 2012, 19:18 Posts: 7 Location: Serbia, Belgrade
|
|
|
|
 |
helenaExpert
|
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Tue 01 May, 2012, 22:27
|
|
User rating: 0
Joined: Tue 07 Feb, 2012, 19:18 Posts: 7 Location: Serbia, Belgrade
|
any change "use of leverage" raises alert
|
|
|
|
 |
API Support
|
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Wed 02 May, 2012, 07:57
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Consider doing something like this: package jforex.account;
import javax.swing.JFrame; import javax.swing.JOptionPane;
import com.dukascopy.api.*;
public class UseOfLeverageAlerter implements IStrategy {
double lastUseOfLeverage; private IAccount account; private IConsole console; @Configurable("Use dialog") public boolean showDialog = true; @Override public void onStart(IContext context) throws JFException { account = context.getAccount(); console = context.getConsole(); lastUseOfLeverage = context.getAccount().getUseOfLeverage();
}
@Override public void onTick(Instrument instrument, ITick tick) throws JFException { double currentUseOfLeverage = account.getUseOfLeverage(); if(Double.compare(currentUseOfLeverage, lastUseOfLeverage) != 0){ String infoMessage = String.format("Leverage changed from %s to %s", lastUseOfLeverage, currentUseOfLeverage); console.getOut().println(infoMessage); if(showDialog){ JOptionPane.showMessageDialog(new JFrame("dialog"),infoMessage); } lastUseOfLeverage = currentUseOfLeverage; } }
@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 {}
@Override public void onStop() throws JFException {}
}
Attachments: |
UseOfLeverageAlerter.java [1.51 KiB]
Downloaded 289 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.
|
|
|
|
|
 |
helenaExpert
|
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Wed 02 May, 2012, 17:33
|
|
User rating: 0
Joined: Tue 07 Feb, 2012, 19:18 Posts: 7 Location: Serbia, Belgrade
|
when changing the "Use of Leverage", can be told that some alarm,song,melodies?
|
|
|
|
 |
helenaExpert
|
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Wed 02 May, 2012, 18:01
|
|
User rating: 0
Joined: Tue 07 Feb, 2012, 19:18 Posts: 7 Location: Serbia, Belgrade
|
can be replaced by INFO messages, the audible alarm ?
|
|
|
|
 |
API Support
|
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Thu 03 May, 2012, 09:53
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
helenaExpert
|
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Thu 03 May, 2012, 12:05
|
|
User rating: 0
Joined: Tue 07 Feb, 2012, 19:18 Posts: 7 Location: Serbia, Belgrade
|
Can you send me to attach. the finished program, simply, use of leverage> 0, the alarm is active, that is all
|
|
|
|
 |
API Support
|
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Thu 03 May, 2012, 12:52
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
helenaExpert
|
Post subject: Re: leverage alert |
Post rating: 0
|
Posted: Sun 06 May, 2012, 22:31
|
|
User rating: 0
Joined: Tue 07 Feb, 2012, 19:18 Posts: 7 Location: Serbia, Belgrade
|
I tried to add an alarm sound start in this program, but to exclude and expel this message:
21:19:21 Strategy "UseOfLeverageAlerter" is stopped at 2012-05-06 21:19:21.569 GMT on the local computer with parameters "Alarm file"=[D:\dukas\wav\feelgood.wav], "Use dialog"=[true]
21:19:21 Stopping "UseOfLeverageAlerter" strategy at 2012-05-06 21:19:21.569 GMT on the local computer 21:19:21 java.security.AccessControlException: access denied (java.io.FilePermission D:\dukas\wav\feelgood.wav read) @ jforex.account.UseOfLeverageAlerter.playSound(UseOfLeverageAlerter.java:131)
please help me, what did I go wrong?
Attachments: |
UseOfLeverageAlerter N.java [2.59 KiB]
Downloaded 293 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: leverage alert |
Post rating: 0
|
Posted: Thu 10 May, 2012, 15:59
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
You have to include this annotation before the class name @RequiresFullAccess // let your code to access any file or directory that you need
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|