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.

Order is not submitted
 Post subject: Order is not submitted Post rating: 0   New post Posted: Fri 11 Feb, 2011, 11:29 

User rating: 5
Joined: Fri 22 Oct, 2010, 09:54
Posts: 24
Dear Support,

I have a strategy and I call executeTask from onTick, but the order is not submitted. Nothing happens. No exception, no message comes in onMessage and no order is submitted. Do you have any idea what should I check?

Here is the Callable object:
private class BuyTask implements Callable<IOrder>{

      private IRule rule;
      private IHistory history;
      
      public BuyTask(IRule rule, IHistory history ){
         this.rule = rule;
         this.history = history;
      }
      @Override
      public IOrder call() throws Exception {
         double sl = rule.getStopLoss();
         double tp = rule.getDefaultTargetProfit();
         log("BUY - LABEL: " + rule.getName()+" PRICE: " +history.getLastTick(rule.getInstrument()).getBid()+" SL: " + sl + " TP: " + tp);
         return engine.submitOrder(   "BUY_" + rule.getStopLoss(),
                              rule.getInstrument(),
                              IEngine.OrderCommand.BUY,
                              1,  // TODO: Adjust according to equity and risk
                              history.getLastTick(rule.getInstrument()).getBid(),
                              slippage,
                              sl,
                              tp);
      }
   }


and here is the call from onTick:
if(selectedRule == null ) return;
      
      if(selectedRule.postEval(tick) == RuleSignal.BUY){
         BuyTask bt = new BuyTask(selectedRule, history );
         this.context.executeTask(bt);
      }
      if(selectedRule.postEval(tick) == RuleSignal.SELL){
         SellTask st = new SellTask(selectedRule, history );
         this.context.executeTask(st);
      }


According to log message before submit, the input parameters of submit are valid. (no exception, no message in onMessage)
I am using DEMO account.

Regards,
Kirilla


 
 Post subject: Re: Order is not submitted Post rating: 0   New post Posted: Fri 11 Feb, 2011, 14:13 

User rating: 5
Joined: Fri 22 Oct, 2010, 09:54
Posts: 24
Dear Support!

Is there any restriction on the "Label" param of the IEngine.submitOrder function? I didn't find any in the API docs, but I found the reason of my problem above. I replaced my label

"BUY_EURUSD:FIFTEEN_MINS:jfstrategies.SimpleMACDRule"

with this one

"BUY"

and it works now.

Best regards,
Kirilla


 
 Post subject: Re: Order is not submitted Post rating: 0   New post Posted: Tue 22 Feb, 2011, 11:39 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
The label must starts with a letter, and can contain alphanumeric symbols but not special characters like ~.


 

Jump to:  

  © 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