Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
Hello All
I have a trend strategy that enters on the closing price of the latest finished bar when all conditions are met. so, it would go long at the high of the bar and short at the low of the bar.
The system is set for using Limit orders. I currently have it set for Market Order. I would like to set it for Limit Order, however, I like to forward test several different strategy settings using virtual machines, so I would not be there live to cancel the limit order if it gets too far away from the entry price.
I am using an ATM strategy. The code for the Limit order I found form NinjaTrader is:
if (orderId.Length == 0 && atmStrategyId.Length == 0 && Close[0] > Open[0])
{
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(Cbi.Action.Buy, OrderType.Limit, Low[0], 0, TimeInForce.Day, orderId, "AtmStrategyTemplate", atmStrategyId);
}
I would like to buy at the High[0] on close and cancel if price goes 6 ticks higher than the closing price without filling me. For short, sell at the Low[0] on close and cancel if price goes 6 ticks lower than the closing price without filling me
attached is a picture. in the lower left corner is a visual of the closing price either long or short in direction with arrows.
any ideas on how to program this?
thanks
Spencer
Can you help answer these questions from other members on NexusFi?
Working with ATM orders in Strategies will take a lot more code than you have there, because you have to do a lot of error checking and depending on your strategy you probably also need to track the open ATM position or possibly close it or modify it after the fact.
I'm sure you probably already know this, but ATM orders are not compatible with backtesting, just FYI. So you will only be able to test it in live data or market replay.
I don't have any code I can share for you because it was all written for paying customers back when I was doing this (I am not any longer), but I would say most likely you'll need to hire the work done at least the first time, to get your framework, and then if you know enough C# you can modify it from there.
and cancel if price goes 6 ticks higher than the closing price without filling me.
exactly this thing here was a main subject of the strategy dsraider was working on - because this cancelation should also happen intrabar and not only if valid at barclose.
have a loot at the thread here :
With the help of several sample strategies I found on the NT forum and a little ingenuity, I have put together a fully-automated, advanced strategy which does the following:
1. Only enters between 10:15 AM and 3:15 PM (EST) (allows …
i dont know how it ended but this was a main problem / challenge in the beginning.
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
Hi Mike
yes, you are the one who told me the difference of ATM strategies and backtesting ones. so you are not doing custom programming anymore? I know I took forever to start that project back in Feb and just ended up getting busy with school---sorry I was not able to hire you back then. you did some good programming for me before. Too bad I cannot hire you now to do this code for me.
I am basically just starting out with C#. I have taken some programming classes, so I understand the basics and object oriented concepts with C++ and some java, but just on a basic level.
yeah, basically I only have about the first 2 hours of the day to trade. I am using the EOT pro room and using their Ncep method. so learning a lot in a condensed period of time. then, doing a journal to track prograss later in day while at school.
It is intersting, and does require some tweaking. so, I did at least figure out how to put in the limit orders with my strategy that uses their system, I want to forward test using the ATM and cancel the limit order if it goes to far away from the set limit price.
from the sound of this, it sounds like this is pretty complex. I would not worry about it if I was able to sit in front of my computer all day like I used to.
plus, I can also test lots of other markets eventually through using several virutal machines all forward testing different settings and markets, etc..
Once I get better with coding, or maybe I can pay somebody, I can also get a strategy management code rather than the ATM so I can backtest over a period of several years using either IQ or esignal continuous.
so, that is where my thoughts are. if you are not custom programming anymore, can you recommend somebody?
thanks
Spencer
Sorry, I don't do this work anymore. And I don't have anyone to recommend any longer as well. Hopefully someone will step forward on the forum and you can work with them.