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.

Easy way to check if there exist any open trade, help please!
 Post subject: Easy way to check if there exist any open trade, help please! Post rating: 0   New post Posted: Wed 18 Jul, 2018, 16:58 

User rating: 4
Joined: Wed 23 May, 2018, 20:08
Posts: 44
Location: FinlandFinland
Hello,

I would like to know a easy way to get informed if there is any open trade at all. Can you pelase helpo me with a easy logic that could solves my question in hand.
Thank you many in advance!

godspeed,
NightOwl.


 
 Post subject: Re: Easy way to check if there exist any open trade, help please! Post rating: 0   New post Posted: Thu 19 Jul, 2018, 03:48 

User rating: 4
Joined: Wed 23 May, 2018, 20:08
Posts: 44
Location: FinlandFinland
PS: For example that if getUsedMargin() = 0 then X, do not make a trade for example. That is what I am asking the keys for. How can you help me approach this problem, please help!
How do I call the API and what about the methods, who, when and how? Help me please.


 
The Best Answer  Post subject: Re: Easy way to check if there exist any open trade, help please! Post rating: 2   New post Posted: Thu 19 Jul, 2018, 19:52 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
            
    public void onStart(IContext context) throws JFException {
        boolean way1 = context.getAccount().getUseOfLeverage() > 0;
        boolean way2 = context.getAccount().getUsedMargin() > 0;
        boolean way3 = false;
        for (IOrder o : context.getEngine().getOrders()) {
            if (o.getFillTime() != 0) {
                way3 = true;
                break;
            }
        }
    }


 
 Post subject: Re: Easy way to check if there exist any open trade, help please! Post rating: 0   New post Posted: Fri 20 Jul, 2018, 18:29 

User rating: 4
Joined: Wed 23 May, 2018, 20:08
Posts: 44
Location: FinlandFinland
Thank you many!


 
 Post subject: Re: Easy way to check if there exist any open trade, help please! Post rating: 0   New post Posted: Mon 23 Jul, 2018, 20:53 

User rating: 4
Joined: Wed 23 May, 2018, 20:08
Posts: 44
Location: FinlandFinland
mtnfx wrote:
            
    public void onStart(IContext context) throws JFException {
        boolean way1 = context.getAccount().getUseOfLeverage() > 0;
        boolean way2 = context.getAccount().getUsedMargin() > 0;
        boolean way3 = false;
        for (IOrder o : context.getEngine().getOrders()) {
            if (o.getFillTime() != 0) {
                way3 = true;
                break;
            }
        }
    }


How often is the state checked.


 

Jump to:  

  © 1998-2024 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