if (myCondition) AtmStrategyChangeStopTarget(0, SMA(Low, 20)[0], "STOP1", "myAtm"); AtmStrategyChangeStopTarget(0, SMA(Low, 40)[0], "STOP2", "myAtm");
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
AtmStrategyCreate()
Collapse
X
-
Howie, you could not directly change the trigger and frequency variables as setup in the original template, however you could change the values of the working stop order, for example -
Code:BertrandNinjaTrader Customer Service
-
Thank you for the snipet. To be sure I understand this would you say the method is the same as changing them on a chart? Meaning when the stops will be readjusted in accordance with the StopStraregy attached to the Launched ATMstrategy?
Thanks a gain for the code sample
Howie
Comment
-
You're welcome, the stopStrategy itself is still working from the template, this code would just adjust the value of the stop / target directly via code. If you all want to self code this and update with your custom algorithms, just don't setup AutoTrails / AutoBreakevens.BertrandNinjaTrader Customer Service
Comment
-
ohowie,
Strategies do not pick up from where they leave off. They are always recalculated. In NT7, strategies will recalculate and then try to map back and live orders to matching strategy orders, but this is not the same as picking up where you left off. If you shut down NT and start up again you are recalculating the strategy.Josh P.NinjaTrader Customer Service
Comment
-
Thank you Josh... would keeping a public variable (Prompted at enabling strategy) set to true or false (by me at enable) to identify if the position was entered yet.
for example:
I reboot knowing a position is open with a stopLoss and ProfitTarget.
I then set the position to true (already in position).
This way it does not enter a new position.
Can I modify somehow the existing StopLoss and ProfitTaget set before reboot?
Sorry to be a pest. This should be the final question.
THANK YOU JOSH
Comment
-
Hello,
I am jumping in here, but I will try to help. No, if I understand, you cannot do what you are trying to do.
However, your system does see the values you input when you attach it each time. You just can't modify the orders from last time.
Additionally, ATM's are a set and forget order system. You can never access them after they are submitted.
The all above assumes you are using NT6.5.DenNinjaTrader Customer Service
Comment
-
AtmStrategyCreate()
Originally posted by NinjaTrader_Ben View PostHello,
I am jumping in here, but I will try to help. No, if I understand, you cannot do what you are trying to do.
However, your system does see the values you input when you attach it each time. You just can't modify the orders from last time.
Additionally, ATM's are a set and forget order system. You can never access them after they are submitted.
The all above assumes you are using NT6.5.
Target.AtmStrategyChangeStopTarget()
I would just need to obtain the unique ID in the event the strategy that created the ATM is disabled inadvertantly. Surely NT must keep or reasign a unique ATMstategyID when it is rebooted because it continues to function onscreen. Yes/No?
Thank you Ben
Comment
-
Josh, I would write the unique ID to disk with the following code sample and then read it on reboot to obtain the uniqueID used to place the order before reboot. Yes/No/Maybe?
Thanks for trying Josh
privatevoid WriteFile(string line, string filename)
{
///
try
{
using (System.IO.StreamWriter writer = new System.IO.StreamWriter(file,true))
{
writer.WriteLine(line);
writer.Dispose();
}
}
catch (System.Exception exp)
{
Log("File write error for file name '" + "' Error '" + exp.Message + "'", LogLevel.Warning);
}
}
publicoverridevoid Dispose()
{
base.Dispose();
}
Comment
-
Josh,
The read and write file work great and recalls the uniqueID from disk but when I pass it as a string to any of the ATM Monitoring methods... no joy. I guess NT7 gets its own additional unique ID for the active ATMs on reboot. Thank you for your efforts.
Howie
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Kaledus, Today, 01:29 PM
|
1 response
6 views
0 likes
|
Last Post Today, 01:53 PM | ||
Started by frankthearm, Yesterday, 09:08 AM
|
13 responses
45 views
0 likes
|
Last Post
by frankthearm
Today, 01:52 PM
|
||
Started by PaulMohn, Today, 12:36 PM
|
2 responses
16 views
0 likes
|
Last Post
by PaulMohn
Today, 01:48 PM
|
||
Started by Conceptzx, 10-11-2022, 06:38 AM
|
2 responses
55 views
0 likes
|
Last Post
by PhillT
Today, 01:47 PM
|
||
Started by yertle, Yesterday, 08:38 AM
|
8 responses
37 views
0 likes
|
Last Post
by ryjoga
Today, 01:22 PM
|
Comment