Been thinking about conversation between Trent and Nick last night…Nick recommended Trent add emergency exit of one sort or another to MRV in addition to stale exit…think I should too…this was I’ve got so far..I want to exit if close 20% below buy price…..seems to work ok in testing so far but…….
Buy = 0;
Sell = 0;
LBIT = 0;
PriceAtBuy = 0;
FlagExit = 0;
StopPrice = 0;
//
for (j = 1; j < BarCount; j++)
{
if (PriceAtBuy==0 AND LE[j])
{
Buy[j] = True;
PriceAtBuy = LEPrice[j];
BuyPrice[j] = LEPrice[j];
StopPrice = PriceAtBuy*0.8;
LBIT[j] = 1;
}
else
if (PriceAtBuy > 0)
{
LBIT[j] = LBIT[j-1]+1;
if (LBIT[j] > 1 AND Exit[j])
{
Sell[j] = True;
SellPrice[j] = Open[j];
PriceAtBuy = 0;
}
if (LBIT[j] == ExitBars[j])
{
FlagExit[j] = True;
}
if (LBIT[j] > ExitBars[j])
{
Sell[j] = True;
SellPrice[j] = Open[j];
Exit[j] = True;
PriceAtBuy = 0;
}
if (LBIT[j] > 1 AND Close[j-1]
{
Sell[j] = True;
SellPrice[j] = Open[j];
Exit[j] = True;
PriceAtBuy = 0;
}
}
}