getTickSize()

jmflukeiii

Member
Joined
May 23, 2020
Posts
18
Likes
9
Hello, I have a simple study that plots a dot above and below bars to generate signals for me and would like to place these dots X ticks above or below the signal bar. However, I am having trouble getting TickSize; can someone provide just a simple example of using getTickSize(), e.g.

double myTicks = getTickSize????

Thank you
 

Spin

Well-known member
Joined
May 22, 2019
Posts
478
Likes
191
This is how I do it most of the time:
  1. (in Initialize) add a line to ask the user how many points the Marker should be above / below the Low / High of the Bar
  2. (in Calculate) get that number from your settings as a double
  3. (also in Calculate) get the Pointsize
  4. (still in Calculate) Define a coordinate to draw the marker (the one in the example below is beneath a Bar's Low)
  5. Draw the marker

Java:
markers.addRow(new IntegerDescriptor(MarkerDistance, get("Distance in Points for markers MA1"), 3, 1, 9999, 1));

var s = getSettings();
double MDistance = s.getInteger(MarkerDistance);

double PointSize = instr.getPointSize();

Coordinate cLow = new Coordinate(series.getStartTime(index), (series.getLow(index) - (MDistance * PointSize)));

if (some logic) {
MarkerInfo Marker1 = getSettings().getMarker(MARKER1);
Marker m = new Marker(cLow, Enums.Position.BOTTOM, Marker1);
addFigure(m);
}
 

jmflukeiii

Member
Joined
May 23, 2020
Posts
18
Likes
9
Spin, I keep getting an error pointing to the "instr." when attempting to build stating "error 155 : cannot find instrument" (or something very similar to that). I'm sorry, I know this seems like something so elementary - I'm really a hack at this and learned primarily back on Ninjatrader where certain things were very simple, i.e. TickSize was just a pre-packaged thing I could use.
 

Spin

Well-known member
Joined
May 22, 2019
Posts
478
Likes
191
Aaaaaaaaaaah, those good old NT-days. Melancholy ;)

Allow me to complete my former post:

Java:
@Override
  protected void calculate(int index, DataContext ctx) {


      DataSeries series = ctx.getDataSeries();
      Instrument instr = ctx.getInstrument();
      double PointSize = instr.getPointSize();

And I hope you also forgive me throwing this tip in your direction (since it seems you really want to learn the 'Art of MW-programming'):

Install a nice IDE, that offers you solutions to error statements, and completes code (I highly recommend IntelliJ), and download the SDK package from MW's site. And then watch, read, copy, paste and use the standard Studies/Strategies as 'skeletons' for your own coding endeavours. Worked for me !
:)
 
Last edited:

jmflukeiii

Member
Joined
May 23, 2020
Posts
18
Likes
9
Aaaaaaaaaaah, those good old NT-days. Melancholy ;)

Allow me to complete my former post:

Java:
@Override
  protected void calculate(int index, DataContext ctx) {


      DataSeries series = ctx.getDataSeries();
      Instrument instr = ctx.getInstrument();
      double PointSize = instr.getPointSize();

And I hope you also forgive me throwing this tip in your direction (since it seems you really want to learn the 'Art of MW-programming'):

Install a nice IDE, that offers you solutions to error statements, and completes code (I highly recommend IntelliJ), and download the SDK package from MW's site. And then watch, read, copy, paste and use the standard Studies/Strategies as 'skeletons' for your own coding endeavours. Worked for me !
:)
No apology needed! That’s how I did it with Ninja, but am so bad with MW so far I can’t even figure out how to open any of the existing studies (the pivots indicator would be very helpful tor something else I’m working on). Although I am now more focused on trading than I was when I “learned” Ninja, I would still very much like to learn.
 
Top