Buy
=
Buycond1;
BuyPrice =
ValueWhen(Buy,O) + spread;
SellProfit = BuyPrice + 0.0030 ;// Take
Profit @ this level
SellLoss = BuyPrice - 0.0015;//
Stoploss @ this level
Sella = Cross(
H,SellProfit); //Sell when 30 pip in profit from
entry price
Sellb = Cross(SellLoss,L) ; //Sell when
15 pip loss from entry price
SellPrice =
IIf( Sella, SellProfit, IIf(Sellb,SellLoss,Null));//Sellprice depends on which condition was
met
priceatbuy=0;
for
( i =
0; i < BarCount; i++ )
{
if( priceatbuy == 0 &&
Buy[ i ] )
priceatbuy = BuyPrice[ i ];
if( priceatbuy > 0 &&
Sella[i] == 1)
{
Sell[ i ] = 1;
SellPrice[ i ] ==
SellProfit;
priceatbuy = 0;
}
if
(
priceatbuy > 0 && Sellb[i] == 1)
{
Sell[ i ] = 1;
SellPrice[ i ] ==
SellLoss;
priceatbuy = 0;
}
else
Sell[ i ] = 0;
}