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.

How to make script that buys on every tick, please help !
 Post subject: How to make script that buys on every tick, please help ! Post rating: 0   New post Posted: Wed 16 Sep, 2020, 13:22 

User rating: 4
Joined: Wed 23 May, 2018, 20:08
Posts: 44
Location: FinlandFinland
How Do I make a simple script that buys all in on every tick? with stop loss 0.1 and take profit 0.1 ? This is what I tried but it is not working... it does no orders at all please help

THe point is to make as much turnover as fast as possible :)

package jforex.orders;

import com.dukascopy.api.*;
import com.dukascopy.api.IEngine.OrderCommand;

public class flipper implements IStrategy {

    private IEngine engine;
    private IConsole console;
    private IOrder order;
   
    @Override
    public void onStart(IContext context) throws JFException {
        IEngine engine = context.getEngine();
         IHistory history = context.getHistory();
         Instrument instrument = Instrument.EURUSD;
         context.setSubscribedInstruments(java.util.Collections.singleton(instrument), true);
       
    }
   
    public void onMessage(IMessage message) throws JFException {}

    public void onTick(Instrument instrument, ITick tick) throws JFException {
         double sl = tick.getAsk() - instrument.getPipValue() * 0.1;
         double tp = tick.getAsk() + instrument.getPipValue() * 0.1;
         
         IOrder order = engine.submitOrder("MOI", instrument, OrderCommand.BUY, 1.0, 0, 5, sl, tp);
   
       
    }
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
    public void onAccount(IAccount account) throws JFException {}
    public void onStop() throws JFException {}}


 
 Post subject: Re: How to make script that buys on every tick, please help ! Post rating: 0   New post Posted: Tue 22 Sep, 2020, 16:22 
Visual JForex expert at Dukascopy
User avatar

User rating:
Joined: Mon 22 Apr, 2013, 11:30
Posts: 604
Location: UkraineUkraine
Hello.

Please use the manual and the example.
https://www.dukascopy.com/wiki/en/devel ... rket-order

Also Label has to be unique for every order.
https://www.dukascopy.com/wiki/en/devel ... ke-a-trade

Regards.


 

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