Darknite
Here's the code you require but it has an error in it that I can seem to get rid of at the moment. As you'll see in the charts below, first one is great with entry and exits perfect, but then on the second chart, it seems to fire off an order on a second bar if the first bar had entry & profit target all within the same bar.
All I can say is try it out and let me know how you get on.
Inputs:
ProfTarget(30),StopLoss(2 ),endtime(2000);
Vars:
ShortEntry(0), Permission(0), Mintick(0), mystop(0), MP(0);
MP = marketposition;
Mintick = minmove/pricescale;
Condition1 = C[1] data3 >C[2] data3 and H data3 > H [1]data3 and H data3 > H[2] data3 and C data3 < O data3;
if condition1 and MP = 0 and time < endtime then begin
ShortEntry = Low of data2 - (1*mintick);
mystop = High of data2 + (Stoploss*mintick);
permission = 1;
end;
if permission = 1 and mro(mp=-1,7,1) = -1 then begin
SellShort next bar at ShortEntry Stop;
Permission = 0;
end;
if permission[2] = 1 then permission = 0;
if mp = -1 then begin
buytocover ("StoppedOut") next bar at mystop stop;
end;
if mp = -1 and time > endtime then setexitonclose;
setprofittarget( ProfTarget );
( Note: Set up your chart like in the pics above, 5 min of stock on data1, 30 min of stock on data2 and $INDU on data3 )
Cheers
Blu-Ray