I'm trying to plot Horizontal lines on the Primary.
I'm trying to use one of the demos, but I can't seem to get it to work.
In onTrade, when I pass in the trade price, it works OK(green line):
Code: Select all
@Override
public void onTrade(double price, int size, TradeInfo tradeInfo) {
level1.addPoint(price);
}
But when I pass in my own value, I don't see the line on the chart and the widget shows a pretty big value:
Code: Select all
@Override
public void onTrade(double price, int size, TradeInfo tradeInfo) {
double test = 61000.0;
//level1.addPoint(price);
level1.addPoint(test);
}
Has anyone done something like this? An opening Range Indicator, Pivot Points, something like that?
I've read over the forums, found this link(which is what I'm attempting to do):
https://bookmap.com/forum/viewtopic.php ... ntal#p4547
Also found this, seems like the same suggestion that I'm trying:
https://bookmap.com/forum/viewtopic.php ... ontal#p571
Yes, drawing a line is in fact placing points using Level 1 API....
I must be missing something, thanks...
Whole thing:
Code: Select all
package com.bookmap.api.simple.demo.indicators;
import java.awt.Color;
import velox.api.layer1.annotations.Layer1ApiVersion;
import velox.api.layer1.annotations.Layer1ApiVersionValue;
import velox.api.layer1.annotations.Layer1SimpleAttachable;
import velox.api.layer1.annotations.Layer1StrategyName;
import velox.api.layer1.data.InstrumentInfo;
import velox.api.layer1.data.TradeInfo;
import velox.api.layer1.messages.indicators.Layer1ApiUserMessageModifyIndicator.GraphType;
import velox.api.layer1.simplified.Api;
import velox.api.layer1.simplified.CustomModule;
import velox.api.layer1.simplified.Indicator;
//import velox.api.layer1.simplified.IndicatorModifiable;
import velox.api.layer1.simplified.InitialState;
import velox.api.layer1.simplified.TradeDataListener;
@Layer1SimpleAttachable
@Layer1StrategyName("Last trade: livex46")
@Layer1ApiVersion(Layer1ApiVersionValue.VERSION2)
public class LastTradeDemoNoHistory implements CustomModule, TradeDataListener
{
protected Indicator level1;
//protected Indicator level2;
@Override
public void initialize(String alias, InstrumentInfo info, Api api, InitialState initialState) {
level1 = api.registerIndicator("tag1", GraphType.PRIMARY);
level1.setColor(Color.GREEN);
//double test = 61000.0;
//level1.addPoint(test);
}
@Override
public void stop()
{
}
@Override
public void onTrade(double price, int size, TradeInfo tradeInfo) {
double test = 61000.0;
level1.addPoint(test);
//level1.addPoint(price);
}
}