So thus the dilemma, how can I get the strategy to make that calculation?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to use CalculationMode.Currency under OnBarUpdate
Collapse
X
-
How to use CalculationMode.Currency under OnBarUpdate
The screenshot probably explains what I am trying to accomplish. I have successfully coded a system where it will enter an initial stop when a position is opened but if I manually move the stop using Chart Trader it will stay where I put it (as opposed to using SetStoploss which resets to default on every bar). But I need to define where the initial stop needs to be. This is no problem if I design the strategy to a specific instrument: I just do the math of how many points/ticks away from current price would equal the dollar amount I want. But this latest strategy I am developing to work across a basket of instruments, so that would be different on each.
So thus the dilemma, how can I get the strategy to make that calculation?Tags: None
-
Hello RaygunWizzle,
The close price is already a price so if you wanted to subtract an amount of price from that you would just subtract that number directly. If you wanted to convert the price to an amount of dollars you would have to know the instruments point size and tick size and then use math to calculate the amount of currency from that. For example the ES point size is 50 and its tick size is 0.25, so:
0.25*50=12.5$ per tick.
You could reverse that as well:
12.5$ / 50 = 0.25
0.25 / TickSize = 1 tick.
In that type of math you would take your dollar amount and convert it to an amount of ticks and then subtract the ticks from the price
Close[0] - (numberOfTicks * TickSize)
-
Yes like I said that is how I am currently doing it but I have to code it specific to each instrument and with this new strategy I want to run it across a basket of instruments. So my question was is there a way to code in for it to automatically do that math just like it does for SetStopLoss.
Comment
-
Maybe if I show you the B part of this coding you will see the operation I am trying to accomplish. This coding works perfectly how I want it to... if I define each strategy to a specific instrument.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
50 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
126 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
69 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment