Add line
-
- Posts: 4
- Joined: Thu Jul 09, 2020 6:19 pm
Add line
Hi, just a quick question, how can I add a price level suppose at price $ 3000 using the simplified wrapper. Thank you
-
- Site Admin
- Posts: 278
- Joined: Mon Jun 11, 2018 11:44 am
- Has thanked: 2 times
- Been thanked: 31 times
Re: Add line
Hi. There are few ways, but easiest is probably registering a modifiable indicator and placing one point far back in time on the relevant price. The line will be automatically continued to the right, since it will be the last known value.
-
- Posts: 548
- Joined: Mon Jul 09, 2018 11:18 am
- Has thanked: 25 times
- Been thanked: 85 times
Re: Add line
Hi germanmb75,
to add a simple line try the code below.
Change the line price and color at Bookmap > Settings > Api plugins config > [plugin name]
Some drawbacks:
- a line starts at the moment the price/color has been set. You can adjust it just as Svyatoslav said.
- when changing the price manually the Apply button stays inactive until the price is readjusted with the spinner. We'll fix this one soon.
to add a simple line try the code below.
Change the line price and color at Bookmap > Settings > Api plugins config > [plugin name]
Some drawbacks:
- a line starts at the moment the price/color has been set. You can adjust it just as Svyatoslav said.
- when changing the price manually the Apply button stays inactive until the price is readjusted with the spinner. We'll fix this one soon.
Code: Select all
package velox.api.layer1.simplified.demo;
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.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.InitialState;
import velox.api.layer1.simplified.Parameter;
@Layer1SimpleAttachable
@Layer1StrategyName("AddLine")
@Layer1ApiVersion(Layer1ApiVersionValue.VERSION2)
public class AddLine implements CustomModule {
@Parameter(name = "Level")
private volatile Integer level = 0;
@Parameter(name = "Line color")
private volatile Color color = Color.YELLOW;
@Override
public void initialize(String alias, InstrumentInfo info, Api api, InitialState initialState) {
Indicator lineIndicator = api.registerIndicator("LevelLine",
GraphType.PRIMARY);
lineIndicator.setColor(color);
lineIndicator.addPoint(level/info.pips);
}
@Override
public void stop() {
}
}