MotiveWave SDK Java no 3rd party coding problems so far

(Last Updated On: November 29, 2018)
Learn the Secret

Get  our 2 Free Books

Get these now which land directly to their inbox.
Invalid email address

Here they are as there are few 3rd party examples

BIG UPDATE BELOW which means I got this partially working!!

I tested to add a Redis NOSQL (3rd party) using simple Jedis Jar. This was done fairly easily with another Mac OS based proprietary platform like Dukascopy JForex. I could see the Redis update when running the strategy or study within MotiveWave. This builds fine. but there does not seem debugging log capabilities for a strategy but there is for studies. Also, when making changes in the Java in Eclipse, the MotiveWave platform does not seem to pick up the latest changes  in a dynamically changed class.  The only way for this to be picked up is by reseting the platform.

My opinion but it is looking good but …

I think there needs to a be lot more samples from MotiveWave instead of just 3 simple studies and 1 strategy. I could only find one other 3rd party providing further examples. Unfortunately, I am not  in the business of spinning my wheels to figure this out as compared to other brokers/platform who provide flawless coding experiences. I think I need to see a demo or better examples.

Until then, I am may just use MotiveWave for charting or connecting with IQFeed only. I can do that with the entry level MotionWave edition. This platform is very exciting indeed but I need to get to see improvements in the above area before I get serious with it from a coding point for view.

BIG UPDATE on getting Java coding! (Nov 29)

See the video to see what is working including text writing and CSV reading files

Here is working Java code as hinted in the video

package study_examples;

import com.motivewave.platform.sdk.common.Coordinate;

import com.motivewave.platform.sdk.common.DataContext;

import com.motivewave.platform.sdk.common.DataSeries;

import com.motivewave.platform.sdk.common.Defaults;

import com.motivewave.platform.sdk.common.Enums;

import com.motivewave.platform.sdk.common.Inputs;

import com.motivewave.platform.sdk.common.MarkerInfo;

import com.motivewave.platform.sdk.common.desc.InputDescriptor;

import com.motivewave.platform.sdk.common.desc.IntegerDescriptor;

import com.motivewave.platform.sdk.common.desc.MAMethodDescriptor;

import com.motivewave.platform.sdk.common.desc.MarkerDescriptor;

import com.motivewave.platform.sdk.common.desc.PathDescriptor;

import com.motivewave.platform.sdk.common.desc.SettingGroup;

import com.motivewave.platform.sdk.common.desc.SettingTab;

import com.motivewave.platform.sdk.common.desc.SettingsDescriptor;

import com.motivewave.platform.sdk.common.desc.ValueDescriptor;

import com.motivewave.platform.sdk.draw.Marker;







import redis.clients.jedis.Jedis;





/** Moving Average Cross. This study consists of two moving averages: 

    Fast MA (shorter period), Slow MA. Signals are generated when the 

    Fast MA moves above or below the Slow MA. Markers are also displayed 

    where these crosses occur. */




  name=”Sample Moving Average Cross”,

  label=”MA Cross”,

  desc=”Displays a signal arrow when two moving averages (fast and slow) cross.”,




public class SampleMACross extends Study


  enum Values { FAST_MA, SLOW_MA };

  enum Signals { CROSS_ABOVE, CROSS_BELOW };


  public void initialize(Defaults defaults)


try {

File file = new File(“/Users/quantlabsnet/atestfile1.txt”);

FileWriter fileWriter = new FileWriter(file);

fileWriter.write(“This is “);

fileWriter.write(“a test”);



} catch (IOException e) {





String csvFile = “/Users/quantlabsnet/country.csv”;

    BufferedReader br = null;

    String line = “”;

    String cvsSplitBy = “,”;

    try {

        br = new BufferedReader(new FileReader(csvFile));

        while ((line = br.readLine()) != null) {

            // use comma as separator

            String[] country = line.split(cvsSplitBy);

            this.debug(“Country [code= ” + country[4] + ” , name=” + country[5] + “]”);


    } catch (FileNotFoundException e) {



    } catch (IOException e) {



    } finally {

        if (br != null) {

            try {


            } catch (IOException e) {






// Jedis jedis = new Jedis(“localhost”); 

//    this.debug(“Connection to server sucessfully”); 

//    //check whether server is running or not 

//    this.debug(“Server is running: “; 


this.debug(“hello debug from SampleMACross()”);


    // User Settings

    SettingsDescriptor sd=new SettingsDescriptor();


    SettingTab tab=new SettingTab(“General”);


    // Fast MA (shorter period)

    SettingGroup ma1=new SettingGroup(“Fast MA”);


    ma1.addRow(new InputDescriptor(Inputs.INPUT, “Fast Input”, Enums.BarInput.CLOSE));

    ma1.addRow(new MAMethodDescriptor(Inputs.METHOD, “Fast Method”, Enums.MAMethod.EMA));

    ma1.addRow(new IntegerDescriptor(Inputs.PERIOD, “Fast Period”, 10, 1, 9999, 1));

    // Slow MA (shorter period)

    SettingGroup ma2=new SettingGroup(“Slow MA”);


    ma2.addRow(new InputDescriptor(Inputs.INPUT2, “Slow Input”, Enums.BarInput.CLOSE));

    ma2.addRow(new MAMethodDescriptor(Inputs.METHOD2, “Slow Method”, Enums.MAMethod.EMA));

    ma2.addRow(new IntegerDescriptor(Inputs.PERIOD2, “Slow Period”, 20, 1, 9999, 1));

    tab=new SettingTab(“Display”);


    SettingGroup lines=new SettingGroup(“Lines”);


    lines.addRow(new PathDescriptor(Inputs.PATH, “Fast MA”, defaults.getGreenLine(), 1.0f, null, true, false, false));

    lines.addRow(new PathDescriptor(Inputs.PATH2, “Slow MA”, defaults.getBlueLine(), 1.0f, null, true, false, false));

    SettingGroup markers=new SettingGroup(“Markers”);


    markers.addRow(new MarkerDescriptor(Inputs.UP_MARKER, “Up Marker”, Enums.MarkerType.TRIANGLE, Enums.Size.SMALL, defaults.getGreen(), defaults.getLineColor(), true, true));

    markers.addRow(new MarkerDescriptor(Inputs.DOWN_MARKER, “Down Marker”, Enums.MarkerType.TRIANGLE, Enums.Size.SMALL, defaults.getRed(), defaults.getLineColor(), true, true));

    // Runtime Settings

    RuntimeDescriptor desc=new RuntimeDescriptor();


    desc.setLabelSettings(Inputs.INPUT, Inputs.METHOD, Inputs.PERIOD, Inputs.INPUT2, Inputs.METHOD2, Inputs.PERIOD2);

    desc.exportValue(new ValueDescriptor(Values.FAST_MA, “Fast MA”, new String[] { Inputs.INPUT, Inputs.METHOD, Inputs.PERIOD }));

    desc.exportValue(new ValueDescriptor(Values.SLOW_MA, “Slow MA”, new String[] { Inputs.INPUT2, Inputs.METHOD2, Inputs.PERIOD2 }));

    desc.exportValue(new ValueDescriptor(Signals.CROSS_ABOVE, Enums.ValueType.BOOLEAN, “Cross Above”, null));

    desc.exportValue(new ValueDescriptor(Signals.CROSS_BELOW, Enums.ValueType.BOOLEAN, “Cross Below”, null));

    desc.declarePath(Values.FAST_MA, Inputs.PATH);

    desc.declarePath(Values.SLOW_MA, Inputs.PATH2);

    // Signals

    desc.declareSignal(Signals.CROSS_ABOVE, “Fast MA Cross Above”);

    desc.declareSignal(Signals.CROSS_BELOW, “Fast MA Cross Below”);

    desc.setRangeKeys(Values.FAST_MA, Values.SLOW_MA);



  protected void calculate(int index, DataContext ctx)


    int fastPeriod=getSettings().getInteger(Inputs.PERIOD);

    int slowPeriod=getSettings().getInteger(Inputs.PERIOD2);

    if (index < Math.max(fastPeriod, slowPeriod)) return; // not enough data

    DataSeries series=ctx.getDataSeries();

    // Calculate and store the fast and slow MAs

    Double, index, fastPeriod, getSettings().getInput(Inputs.INPUT));

    Double, index, slowPeriod, getSettings().getInput(Inputs.INPUT2));

    if (fastMA == null || slowMA == null) return;

    series.setDouble(index, Values.FAST_MA, fastMA);

    series.setDouble(index, Values.SLOW_MA, slowMA);

    if (!series.isBarComplete(index)) return;

    // Check to see if a cross occurred and raise signal.

    Coordinate c=new Coordinate(series.getStartTime(index), slowMA);

    if (crossedAbove(series, index, Values.FAST_MA, Values.SLOW_MA)) {

      MarkerInfo marker=getSettings().getMarker(Inputs.UP_MARKER);

      if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.BOTTOM, marker));

      ctx.signal(index, Signals.CROSS_ABOVE, “Fast MA Crossed Above!”, series.getClose(index));


    else if (crossedBelow(series, index, Values.FAST_MA, Values.SLOW_MA)) {

      MarkerInfo marker=getSettings().getMarker(Inputs.DOWN_MARKER);

      if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.TOP, marker));

      ctx.signal(index, Signals.CROSS_BELOW, “Fast MA Crossed Below!”, series.getClose(index));







NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!
This entry was posted in Quant Development and tagged , , , , , on by .

About caustic

Hi i there My name is Bryan Downing. I am part of a company called QuantLabs.Net This is specifically a company with a high profile blog about technology, trading, financial, investment, quant, etc. It posts things on how to do job interviews with large companies like Morgan Stanley, Bloomberg, Citibank, and IBM. It also posts different unique tips and tricks on Java, C++, or C programming. It posts about different techniques in learning about Matlab and building models or strategies. There is a lot here if you are into venturing into the financial world like quant or technical analysis. It also discusses the future generation of trading and programming Specialties: C++, Java, C#, Matlab, quant, models, strategies, technical analysis, linux, windows P.S. I have been known to be the worst typist. Do not be offended by it as I like to bang stuff out and put priorty of what I do over typing. Maybe one day I can get a full time copy editor to help out. Do note I prefer videos as they are much easier to produce so check out my many video at