I m posting this simple strategy to ask someone an advice or.
It is on supertrend indicator contrarian.
it works more o less and close all at 16.00but I m not able to setting to exit when the profit pr loss is 100 euro for example.
to me is just good if is reach 100 profit so ,if someone has some good advice is welcome.
Code: Select all
[LegacyColorValue = TRUE];
ATRLength(1.5), ATRMult(4.9), UpColor(cyan), DnColor(magenta),
if date <> date then begin
yesterdaynet = NetProfit;
ATR = AvgTrueRange(ATRLength) * ATRMult;
avg = (high + low)/2;
up = avg + ATR;
dn = avg - ATR;
if close > up then
trend = 1
else if close < dn then
trend = -1;
if trend < 0 and trend > 0 then flag=1 else flag=0;
if trend > 0 and trend < 0 then flagh = 1 else flagh = 0;
if trend > 0 and dn < dn then dn=dn;
if trend < 0 and up > up then up=up;
if flag = 1 then up = avg + ATR;
if flagh = 1 then dn = avg - ATR;
todaynet = NetProfit + openpositionprofit - yesterdaynet;
condition98 = (-dailyloss < todaynet and todaynet < dailyprofit) and (Time > starttrade and time < endtrade);
if condition98 then begin
if trend = 1 and trend< 0 Then sellshort next bar at open;
if trend = -1 and trend< 0 then buy next bar at open;
if trend = 1 and time >endtrade then buy to cover this bar Close;
if trend = -1 and time >endtrade then sell this bar close;