Pine Script to cTrader Script

Created at 04 Jun 2022
RE

RenaeOng

Joined 28.03.2022

Status

Open


Budget

35.00 USD


Payment Method

Direct Payment

Job Description

Hi, I would like your help to convert the pine script below to ctrader script due to limited knowledge in programming. Do let me know if the cbot would not be able to work on the following script.

 

// Moving averages input
len1 = input(6, minval=1, title="MA1")
len2 = input(20, minval=1, title="MA2")
len3 = input(50, minval=1, title="MA3")
len4 = input(200, minval=1, title="MA3")

// Define moving averages
ma1 = ema(close, len1)
ma2 = ema(close, len2)
ma3 = ema(close, len3)
ma4 = sma(close, len4)
ma1H1 = security(syminfo.tickerid, '60', ma1)
ma2H1 = security(syminfo.tickerid, '60', ma2)
ma3H1 = security(syminfo.tickerid, '60', ma3)
ma4H1 = security(syminfo.tickerid, '60', ma4)
ma1D1 = security(syminfo.tickerid, 'D', ma1)
ma2D1 = security(syminfo.tickerid, 'D', ma2)
ma3D1 = security(syminfo.tickerid, 'D', ma3)
ma4D1 = security(syminfo.tickerid, 'D', ma4)

// Plot moving averages
plot(ma1, title="MA1", color=color.blue, linewidth = 2)
plot(ma2, title="MA2", color=color.orange, linewidth = 2)
plot(ma3, title="MA3", color=color.green, linewidth = 2)
plot(ma4, title="MA4", color=color.purple, linewidth = 2)


//Higher High or Lower Low Entry Inputs
price = input(close)
LookBack = input(30)
Highest = highest(LookBack)
Lowest = lowest(LookBack)

long = price > Highest[1] 
short = price < Lowest[1]


//Safety Confirmation Inputs - Helps to thin out false breakouts or break downs
length = input(10)
High_Guard = highest(length)
Low_Guard = lowest(length)
length2 = input(1)

long1 = long == 1 and Highest[1] > High_Guard[length2]
short1 = short == 1 and Lowest[1] < Low_Guard[length2]


// Define long/short conditions
longCond = long1 and close > ma4H1 and close > ma4D1
shortCond = short1 and close < ma4H1 and close < ma4D1

longCondition = longCond and inDateRange
shortCondition = shortCond and inDateRange

plotshape(longCondition, title="Buy Signal", text="B", textcolor=color.white, style=shape.labelup, location=location.belowbar, color=color.green, transp=0)
plotshape(shortCondition, title="Short Signal", text="S", textcolor=color.white, style=shape.labeldown, location=location.abovebar, color=color.red, transp=0)

atr = atr(20)

// Submit entry orders, but only when bar is inside date range
if longCondition
    stop_level = close - atr * 2
    profit_level = close + atr * 4
    strategy.entry(id="EL", long=true)
    strategy.exit(id="TP/SL", id="EL", stop=stop_level, limit=profit_level)

if shortCondition
    stop_level = close + atr * 2
    profit_level = close - atr * 4
    strategy.entry(id="EL", long=false)
    strategy.exit(id="TP/SL", id="ES", stop=stop_level, limit=profit_level)

Comments
Log in to add a comment.
4xDev's avatar
4xDev · 2 years ago

Hello!
My name is Mike from 4xdev. I am a member of the 4xdev development company, specialized in creating trading tools:
custom indicators, EAs, scripts, bots, alerts, cAlgo, cBots, etc.

We have a great experience in a сTrader platform.
Our clients are satisfied with the quality of our work and repeatedly contact us after completing an order to optimize their own cAlgos.
You can see reviews of us at forexpeacearmy.com and trustpilot.com, and our website 4xdev.com.

We can help you with your project. Please let me know if you are interested (support@4xdev.com).

We offer the rate in the amount of $60 per hour, including the work of our programmers and QA-engineer.
The cost starts from $300 on average.

Looking forward to hearing from you.

JosephTradingbot's avatar
JosephTradingbot · 2 years ago

Hi, I can do that for you.

with several years of experience in programming and forex analysis and trading.

Telegram: @iamjosepe

Email: joseph.tradingbot@gmail.com