How can I convert a Pinescript code to MQL5 code for mt5

 

Guys How can I re-write a piece of pinescript code in Metaeditor. I have nearly zero knowledge in coding but my aim is basically running a strategy that I run on Tradingview on mt5 as well. 

//@version=5
strategy("Price Channel Strategy", overlay=true)
length = input(20)
hh = ta.highest(high, length)
ll = ta.lowest(low, length)
if (not na(close[length]))
    strategy.entry("PChLE", strategy.long, comment="PChLE", stop=hh)
    strategy.entry("PChSE", strategy.short, comment="PChSE", stop=ll)
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)


This is the pine script code. Can you help me re-write it for mt5 

 
Order a freelance
 
tahaozonder: I have nearly zero knowledge in coding b

You have only four choices:

  1. Search for it (CodeBase or Market). Do you expect us to do your research for you?

  2. Try asking at:

  3. MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  4. Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2019)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help (2017)

 
William Roeder #:

You have only four choices:

  1. Search for it (CodeBase or Market). Do you expect us to do your research for you?

  2. Try asking at:

  3. MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  4. Or pay (Freelance) someone to code it. Top of every page is the link Freelance.
              Hiring to write script - General - MQL5 programming forum (2019)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help (2017)


Ok I am not asking anyone to do my research for me  I actually did try to code it But I am getting errors this is the code I wrote on mql5 and I get these errors. 


Files:
 
tahaozonder #: Ok I am not asking anyone to do my research for me  I actually did try to code it But I am getting errors this is the code I wrote on mql5 and I get these errors. 

Please don't show screenshots for code. Attached the code properly as a file, or using the "</>" icon or Alt-S to post the code.

Based on the screenshot, you have totally invalid MQL5 code.

  • You are using MQL4 trade functions which are not the same on MQL5.
  • You are not closing your brackets/braces properly.
  • You are also not calculating your order volume (lots) correctly.

As it stands, you need to dedicate much more time and effort to learning MQL5. Maybe by starting here ...

Articles

Step-By-Step Guide to writing an Expert Advisor in MQL5 for Beginners

Samuel Olowoyo, 2010.06.09 11:37

The Expert Advisors programming in MQL5 is simple, and you can learn it easy. In this step by step guide, you will see the basic steps required in writing a simple Expert Advisor based on a developed trading strategy. The structure of an Expert Advisor, the use of built-in technical indicators and trading functions, the details of the Debug mode and use of the Strategy Tester are presented.
 
CarniVore:

Guys How can I re-write a piece of pinescript code in Metaeditor. I have nearly zero knowledge in coding but my aim is basically running a strategy that I run on Tradingview on mt5 as well. 

//@version=5
strategy("Price Channel Strategy", overlay=true)
length = input(20)
hh = ta.highest(high, length)
ll = ta.lowest(low, length)
if (not na(close[length]))
    strategy.entry("PChLE", strategy.long, comment="PChLE", stop=hh)
    strategy.entry("PChSE", strategy.short, comment="PChSE", stop=ll)
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)


This is the pine script code. Can you help me re-write it for mt5 

What is the strategy criteria ? Entry on each bar on both sides ?
The entry decision is missing if im not mistaken the stops are for being outside the channel i assume

Reason: