Surely I'm making something wrong, but I don't know what.
The problem is this:
Suppose that I've a 60 min chart and a momentum on open bar of this 60min chart.
If the condition of the momentum is met, the signal must Buy or sell at a specified price.
I'm forced by the script to use "Buy /Sell Next bar at price X".
This way the order could be executed even this bar (with IOG enabled), and this is good, but if it is executed this bar and it reaches in this bar the profit target or the Stop Loss target it exits the position how it should.
The problem is on next bar on which the signal generates a new order with relative Profit and Stop Loss, and I want to avoid this.
Here is an example of what I mean:
Code: Select all
[IntrabarOrderGeneration = true]
Inputs:
Length.Momentum(14),
Price.Momentum(open),
N.Contracts(1),
N.Ticks.Profit(10),
N.Ticks.Stop(10);
vars:
H1(0),
L1(0),
H2(0),
L2(0),
H3(0),
L3(0),
M1(0),
M2(0),
M3(0),
var1(0),
Last.Low(0),
Last.High(0);
H3 = High[2]; //High 2 candles ago
L3 = Low[2]; //Low 2 candles ago
H2 = High[1]; //High prior candle
L2 = Low[1]; //Low prior candle
H1 = High; //High last candle
L1 = Low; //Low last candle
var1 = momentum(Price.momentum, Length.Momentum); //momentum OPEN
M3 = var1[2]; // momentum 2 candles ago
M2 = var1[1]; // momentum prior candle
M1 = var1; // actual momentum
//******************************
// ******** LONG conditions ******
condition11 = L3 > L2 and M3 > M2;
condition12 = L2 < L1 and M2 > M1;
condition13 = condition11 and condition12;
if condition13 then begin
Last.High = High + (1*(minmove/pricescale)); //Identify the MAX for the breakout Entry
END; // : END if condition13 then begin
// *** LONG Order ***
if condition13 and marketposition = 0 then begin
Buy ("Buy Long 1") N.contracts contracts next bar at (High[1] + (1*(minmove/pricescale)))stop;
end; // : END LONG order
// ** STOP PROFIT and STOP LOSS Orders ****
SetStopposition;
SetStopLoss(((bigpointvalue*(minmove/pricescale))*N.ticks.Stop));
SetProfitTarget(((bigpointvalue*(minmove/pricescale))*N.ticks.profit));
How can I avoid these repeated orders ?
If the condition is met and the order is filled and the position is closed even in within this bar, it should not generates a new order next bar.
How to achieve this ?
Can someone help me or suggest something.
I'm relatively new to signal. I've always practice discretionary trading with my properties indicators, so I'm not so skilled with signal orders.
Thanks