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)
Using range 1 instead of tick 1 is much more efficient and will still manage the trade every 1 tick of price movement. Helpful for trailing stops or etc.
my idea is :
to cancel a limitorder if i get no fill and the price is running away.
i have a strategy that is working OK.
now i add
Add(PeriodType.Range, 1) In the Initialize section -- a basic thing.
now i found out that i have to use if (BarsInProgress == 0)
at the biginning to keep my strategy in the basic timeframe for checking the entryconditions.
Once my limit-order is in the market, i want to use the second timeframe (1 Range) to manage the order-canceling if needed.
i tried different ways - also with if (BarsInProgress == 1) or Highs[1] [0] to have a switch to the 1 Range timeframe --- with no sucsess.
samething i am doing wrong.
any tips / ideas to that ?
if
(
create==1 // means Limit-Order is in the market
&&
valueClose +5 <= Highs[1] [0]
// ( valueClose +5 = the last Barclose+5 ticks of the main timeframe )
//( Highs[1] [0] should represent the High of the 1-Range-timeframe)
)
{
AtmStrategyCancelEntryOrder(entryorderid);
}
max-td
Can you help answer these questions from other members on NexusFi?
If you use any BarsSinceEntry() or BarsSinceExit() anywhere in your script at all, you must rewrite them to make them MTF compatible. Change to BarsSinceEntry(0, "long", 0) to indicate barsarray 0, signal name "long", last entry.
If you aren't using that and still having trouble... Highs[1][0] would represent barsarray 1 bar 0 (last bar). You are right.
Also on your order submission, you can submit it to a smaller time frame:
EnterLong(1, 3, "long");
This will submit to bars array 1, order quantity 3, for long. Submitting to smaller time frame is useful for limit order because ninja will cancel the limit order at the end of the bar if not filled so keep in mind this and size of time frame.
As for cancelling an order manually, sorry I can not help. I do not use limit orders because of all the extra bugs in ninja to deal with them in backtesting.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
Also remember your other indicator based signals to need changing such as
double ma = EMA(BarsArray[1], 21)[0];
You can do the if (BarsInProgress == 1) method as well, but remember that if you check a dataseries value for a BarsArray other than current it will be zero/null. For instance if you .Set a dataseries in array 1 and check it in array 0, sometimes it will be zero/null.
I prefer to set the dataseries in all time frames and call it using the BarsArray[x] method so the dataseries is never 0/null.
so I am pointing all of this out because I do not know if your script in general is not MTF compatbile until you make all these changes or if everything is fine except you cant cancel the order.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain