Code: Select all
Inputs: wf(0.5), perc(0.5), portionTakeProfit(2.5);
Vars: indecisionBar(false),closeOnUpperPerc(false),closeOnLowerPerc(false),
buyCondition(false), sellShortCondition(false),
indecisionBar = absvalue(Open - Close) < (wf * Range);
closeOnUpperPerc = Close > Low + (perc * Range);
closeOnLowerPerc = Close < High - (perc * Range);
buyCondition = indecisionBar AND closeOnUpperPerc;
sellShortCondition = indecisionBar AND closeOnLowerPerc;
if(buyCondition AND MarketPosition = 0) then
begin
buy 10 contracts next bar High data2 stop; // BUY ON ASK PRICE
sell("Stop Loss") next bar (High - (averagetruerange(2)/3)) stop; //STOP LOSS
sell next bar (High + (averagetruerange(2)/2.5)) limit; //PROFIT TARGET
end;
data1 : eur/usd weekly bid price
data2 : eur/usd weekly ask price