I have been messing around with my strategy and have made progress, but have run into a snag.
The underlying of my strategy is to have one entry point, and to scale out of a position. I had an ATM strategy that did this but want to use something similar to it in my strategy. It seems that is not possible to import the ATM but I made something similar in my strategy.
So what I had to do is actually create two entries at the same time to each order one contract on the NQ
Each of those entries has a unique ID Long1, and Long2. And each of them has a correlated Stop Loss, and profit target.
They have the same stop loss and they have different exit parameters. One will exit sooner if it goes south, the other will have a longer leash.
Here is how the Bones look:
else if (State == State.Configure)
{
SetStopLoss(@"long1", CalculationMode.Ticks, 35, true);
SetStopLoss(@"long2", CalculationMode.Ticks, 35, true);
SetProfitTarget(@"long1", CalculationMode.Ticks, 35);
SetProfitTarget(@"long2", CalculationMode.Ticks, 80);
(Strategy goes here)
{
EnterLongLimit(Convert.ToInt32(1), (GetCurrentBid(0) + (-1 * TickSize)),@"long1");
EnterLongLimit(Convert.ToInt32(1), (GetCurrentBid(0) + (-1 * TickSize)),@"long2");
entrySubmit = true;
if (CrossBelow(Close, SMAF, 1))
{
ExitLong((1), "SLongSma", "long1");
}
if (CrossBelow(Close, Bollinger1.Middle, 1)
ExitLong((1), "SLongBB", "long2");
NOW HERE IS THE ISSUE:
Often times My strategy will enter and the first long will exit to protect profit. and then soon after get the signal to enter the position again., But only for one more contract.This is creating too many entries for me and a lot of noise I do not want.
My entries per direction is set to 2, and my StartBehavior = StartBehavior.WaitUntilFlat;
Then why is it that My Strategy still will enter my long1 position again over and over while I still have my long2 position open that has not been closed yet?
Is there anyway so that I can make sure it does not enter any more trades until my Long2 has stopped out or reached its profit target? Or is there any other way I can code this to make it work ?
Thanks for any help.
Cheers,
Tim
Comment