thx
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
ATM in ninjascript
Collapse
X
-
ATM in ninjascript
Trying to use one of my ATM strategies in an automated strategy. can't seem to find any good way to do it. I know of the sample strategy in nj, but when I try to trigger an order based on SMA crossing and let the ATM take over nothing really happens.
thxTags: None
-
[QUOTE=julianmo;459246]Trying to use one of my ATM strategies in an automated strategy. can't seem to find any good way to do it. I know of the sample strategy in nj, but when I try to trigger an order based on SMA crossing and let the ATM take over nothing really happens.
thx.
-
Hello julianmo,
Thank you for your post and welcome to the NinjaTrader Support Forum!
In general, if the ATM strategy does not take over then there is an error in the Log tab. Do you receive an error on screen? Are there errors on the Log tab of the Control Center? If so, what do these errors report?
I look forward to your response.
Comment
-
Hi PatrickH, I can't even begin to write the code for it. What I wanted is for example was to have my ATM strategy fire off when I get a cross over on my signal.
If SMA 10 Cross above SMA 25 buy, and when that happens, ATM will oversee the stops sell etc. I just need to know how I would code the ATM firing off instead of just a buy. In the code below, where and how would I write the code for the ATMstrategy to be included
I hope I made myself clear, thanks.
/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(SMA(10), SMA(25), 1))
{
EnterLong(DefaultQuantity, "");
}
// Condition set 2
if (CrossBelow(SMA(10), SMA(25), 1))
{
EnterShort(DefaultQuantity, "");
}
Comment
-
Hello julianmo,
Thank you for your response.
To implement that logic it would be best to understand the SampleAtmStrategy you are aware of as well as looking into the ATM Strategy functions and methods at the following link: http://ninjatrader.com/support/helpG...gy_methods.htm
If you have any questions please let me know.
Comment
-
Hello julianmo,
Thank you for your response.
When not using ATM Strategy methods you can simply use the EntriesPerDirection. When using ATM Strategy methods you must implement logic to prevent multiple entries from taking place. Such as ensuring that certain conditions are meet before entering again. You would need to implement your own manual count that increases and decreases when the positions are open and closed.
Please let me know if you have any questions.
Comment
-
Hello julianmo,
Thanks for your reply.
You would control the flow of your program using bool variables that are either true or false. For example using a bool called doItOnce will help control your entries to just one. (You can call the variables whatever you wish as it is your program and you will need to be able to read and follow it)
The bool would be declared and initialized to a true state in the regions variables.
Code:if (doItOnce && your entry conditions) { // ATM entry order stuff here doItOnce = false; // now set to false so only one order placed }
Later you would need a condition to reset the bool back to true so that you could place subsequent orders. A typical place to do this would be where you check to see that you are in a flat market position.
Here is a reference to using bools: http://ninjatrader.com/support/helpG...sic_syntax.htm
Here is a reference to checking position: http://ninjatrader.com/support/helpG...etposition.htmPaul H.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by andrewtrades, Today, 04:57 PM
|
1 response
10 views
0 likes
|
Last Post Today, 05:02 PM | ||
Started by chbruno, Today, 04:10 PM
|
0 responses
6 views
0 likes
|
Last Post
by chbruno
Today, 04:10 PM
|
||
Started by josh18955, 03-25-2023, 11:16 AM
|
6 responses
436 views
0 likes
|
Last Post
by Delerium
Today, 03:42 PM
|
||
Started by FAQtrader, Today, 03:35 PM
|
0 responses
9 views
0 likes
|
Last Post
by FAQtrader
Today, 03:35 PM
|
||
Started by rocketman7, Today, 09:41 AM
|
5 responses
20 views
0 likes
|
Last Post Today, 03:33 PM |
Comment