KVSParticipant
New
Hi all,
I would like to convert the attached trading system into ProBuilder code, for use in ProRealTime. The original system was build in MultiCharts using PowerLanguage. I intend to trade this on the equivalent CFD via IG. As such, I would like the TakeProfit and Stoploss targets to use point values. I also expect to have to adjust the trade times. I would greatly appreciate if you can also consider any efficiency improvements that could be applied to the script.
Kind Regards
Kane
JSParticipant
Senior
The ‘problem’ with this system is that it includes many indicators (BB, EMAs, RSI, MFI, ADX), all of which need to be aligned with each other…
// Parameters
defparam cumulateorders = false
TimeFrame(30 minutes)//,UpdateOnClose)
BeginTime = 083000 // 08:30 London time
EndTime = 203000 // 20:30 London time
Len = 18
Len2 = 28
OB = 71
OS = 20
BBSD = 1.5
emaLenLX = 27
emaLenSX = 28
adxLen = 5
minChng = 0.1
TakeProfit = 260
StopLoss = 140
MySize = 1
// Indicators
Avg=Average[Len](Close)
UpperBB = Avg+Std[Len](Close)*BBSD
LowerBB = Avg-Std[Len](Close)*BBSD
emaLX = ExponentialAverage[emaLenLX](close)
emaSX = ExponentialAverage[emaLenSX](close)
rsiVal = RSI[Len2](close)
mfiVal = MoneyFlowIndex[Len2]
rsiMFI = (rsiVal + mfiVal) / 2
adxVal = ADX[adxLen]
adxPrev = adxVal[1]
// Setup-condities
BuySetup = close[1] < LowerBB[1] and rsiMFI < OS
SellSetup = close[1] > UpperBB[1] and rsiMFI > OB
inTimeWindow = (time >= BeginTime and time <= EndTime)
// Entry Long
if not longonmarket and inTimeWindow and BuySetup then
if close > LowerBB and (adxPrev - adxVal) > minChng then
buy MySize contracts at market
EndIf
// Entry Short
if not shortonmarket and inTimeWindow and SellSetup then
if close < UpperBB and (adxPrev - adxVal) > minChng then
sellshort MySize contracts at market
EndIf
// Exit Long
if longonmarket and close > emaLX then
sell at market
EndIf
// Exit Short
if shortonmarket and close < emaSX then
exitshort at market
EndIf
// Order Management
set target profit TakeProfit * pointvalue
set stop Loss StopLoss * pointvalue
EndIf
EndIf
GraphOnPrice UpperBB
GraphOnPrice LowerBB
GraphOnPrice emaLX
GraphOnPrice emaSX
Graph rsiVal
Graph mfiVal
Graph rsiMFI
Graph adxVal
Graph BuySetup
Graph SellSetup
KVSParticipant
New
Thanks JS. Much appreciate your efforts with this conversion.