Hi Roberto,
I did add the Volume > 0 to the code but it still seems to stop. I do not know if it could be the VolB = 0 or the VolC = 0? But in the calculation of the indicator I need it to start the count at 0. Any suggestions? See the code below:
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
Timeframe(hourly)
HTrend = Average[30](close) < Average[80](close)
Timeframe(default)
Possize = 1
// Custom Indicators
VolB = 0
Blength = 4
Slength = 4
If Volume > 0 Then
If Close > Open Then
VolB = VolB + Volume
if Open = Close and Close – Low => High – Close Then
VolB = VolB + Volume
Endif
Endif
Endif
BV = VolB
TotBuy = Close * BV
NetBuy = summation[Blength](TotBuy)
NetBuyVol = summation[Blength](VolB)
VWBuyAvg = NetBuy/NetBuyVol
VolS=0
If Volume > 0 Then
If Close < Open Then
VolS = VolS + Volume
if Open = Close and Close – Low =< High – Close Then
VolS = VolS + Volume
Endif
Endif
Endif
SV = VolS
TotSell = Close * SV
NetSell = summation[Slength](TotSell)
NetSellVol = summation[Slength](VolS)
VWSellAvg = NetSell/NetSellVol
// Use the cross over signal and RSI value to determine the entry price
if HTrend and VWBuyAvg[1] > VWSellAvg[1] and VWBuyAvg < VWSellAvg Then
if rsi[4](close) > 70 Then
Sellshort Possize contract at market
Endif
Endif
// Stops and targets
SET STOP pLOSS 230
SET TARGET pPROFIT 290