Could you help me to convert from pinescript to easy lenguaje - futures io
futures io

Could you help me to convert from pinescript to easy lenguaje

Discussion in EasyLanguage Programming

    1. trending_up 420 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

Could you help me to convert from pinescript to easy lenguaje

(login for full post details)
  #1 (permalink)
Mulege, Baja California Sur
Posts: 4 since Nov 2022
Thanks: 0 given, 1 received

Could you help me to convert to easy lenguaje, i backtestet in tradingview since 2012, gives me more than 400% but y want to test in easy lenguaje for get more data
// Get Inputs Long
allow_long = input.bool(title="Allow Long", defval=true, group="inputs long")
fast_length_long ="Fast Length Long", defval=13, group="inputs long")
slow_length_long ="Slow Length Long", defval=19, group="inputs long")
src_long = input.source(title="Source Long", defval=close, group="inputs long")
signal_length_long ="Signal Smoothing Long", minval = 1, maxval = 50, defval = 9, group="inputs long")
sma_source_long = input.string(title="Oscillator MA Type Long", defval="EMA", options=["SMA", "EMA"], group="inputs long")
sma_signal_long = input.string(title="Signal Line MA Type Long", defval="EMA", options=["SMA", "EMA"], group="inputs long")
cross_point_long ="Cross Point Long", defval=0, group="inputs long")
cross_delay_macd_long ="MacD Cross Delay Long", defval=0, group="inputs long")
signal_must_cross_long = input.bool(title="Signal Must Also Cross Long", defval=false, group="inputs long")
cross_delay_signal_long ="Signal Cross Delay Long", defval=0, group="inputs long")

//Get Inputs Short
allow_short = input.bool(title="Allow Short", defval=true, group="inputs short")
fast_length_short ="Fast Length Short", defval=11, group="inputs short")
slow_length_short ="Slow Length Short", defval=20, group="inputs short")
src_short = input.source(title="Source Short", defval=close, group="inputs short")
signal_length_short ="Signal Smoothing Short", minval = 1, maxval = 50, defval = 9, group="inputs short")
sma_source_short = input.string(title="Oscillator MA Type Short", defval="EMA", options=["SMA", "EMA"], group="inputs short")
sma_signal_short = input.string(title="Signal Line MA Type Short", defval="EMA", options=["SMA", "EMA"], group="inputs short")
cross_point_short ="Cross Point Short", defval=0, group="inputs short")
cross_delay_macd_short ="MacD Cross Delay Short", defval=1, group="inputs short")
signal_must_cross_short = input.bool(title="Signal Must Also Cross Short", defval=false, group="inputs short")
cross_delay_signal_short ="Signal Cross Delay Short", defval=0, group="inputs short")

use_stop_loss_long = input.bool(defval=false,title="Use Stop Loss Long", group="Stop/Profit Long")
stop_loss_long_percentage = input.float(defval=1,title="Stop Loss % Long",minval=0.0,step=0.1, group="Stop/Profit Long") * .01
use_take_profit_long = input.bool(defval=false,title="Use Take Profit Long", group="Stop/Profit Long")
take_profit_long_percentage = input.float(defval=1,title="Take Profit % Long",minval=0.0,step=0.1, group="Stop/Profit Long") * .01
use_stop_loss_short = input.bool(defval=true,title="Use Stop Loss Short", group="Stop/Profit Short")
stop_loss_short_percentage = input.float(defval=21,title="Stop Loss % Short",minval=0.0,step=0.1, group="Stop/Profit Short") * .01
use_take_profit_short = input.bool(defval=true,title="Use Take Profit Short", group="Stop/Profit Short")
take_profit_short_percentage= input.float(defval=20,title="Take Profit % Short",minval=0.0,step=0.1, group="Stop/Profit Short") * .01

// Plot colors Long
col_macd_long = input.color(#2962FF, "MACD Line Long", group="Color Settings", inline="MACD")
col_signal_long = input.color(#FF6D00, "Signal Line Long", group="Color Settings", inline="Signal")
col_grow_above_long = input.color(#26A69A, "Grow Above Long", group="Histogram Color Settings", inline="Above Long")
col_fall_above_long = input.color(#B2DFDB, "Fall Above Long", group="Histogram Color Settings", inline="Above Long")
col_grow_below_long = input.color(#FFCDD2, "Grow Below Long", group="Histogram Color Settings", inline="Below Long")
col_fall_below_long = input.color(#FF5252, "Fall Below Long", group="Histogram Color Settings", inline="Below Long")

// Plot colors Short
col_macd_short = input.color(#B03DFF, "MACD Line Short", group="Color Settings", inline="MACD")
col_signal_short = input.color(#00FFE8, "Signal Line Short", group="Color Settings", inline="Signal")
col_grow_above_short = input.color(#D95965, "Grow Above Short", group="Histogram Color Settings", inline="Above Short")
col_fall_above_short = input.color(#4D2024, "Fall Above Short", group="Histogram Color Settings", inline="Above Short")
col_grow_below_short = input.color(#00322D, "Grow Below Short", group="Histogram Color Settings", inline="Below Short")
col_fall_below_short = input.color(#00ADAD, "Fall Below Short", group="Histogram Color Settings", inline="Below Short")

// Calculate Long
fast_ma_long = sma_source_long == "SMA" ? ta.sma(src_long, fast_length_long) : ta.ema(src_long, fast_length_long)
slow_ma_long = sma_source_long == "SMA" ? ta.sma(src_long, slow_length_long) : ta.ema(src_long, slow_length_long)
macd_long = fast_ma_long - slow_ma_long
signal_long = sma_signal_long == "SMA" ? ta.sma(macd_long, signal_length_long) : ta.ema(macd_long, signal_length_long)
hist_long = macd_long - signal_long

// Calculate Short
fast_ma_short = sma_source_short == "SMA" ? ta.sma(src_short, fast_length_short) : ta.ema(src_short, fast_length_short)
slow_ma_short = sma_source_short == "SMA" ? ta.sma(src_short, slow_length_short) : ta.ema(src_short, slow_length_short)
macd_short = fast_ma_short - slow_ma_short
signal_short = sma_signal_short == "SMA" ? ta.sma(macd_short, signal_length_short) : ta.ema(macd_short, signal_length_short)
hist_short = macd_short - signal_short

//Plot Long
plot(hist_long, title="Histogram Long", style=plot.style_columns, color=(hist_long>=0 ? (hist_long[1] < hist_long ? col_grow_above_long : col_fall_above_long) : (hist_long[1] < hist_long ? col_grow_below_long : col_fall_below_long)))
plot(macd_long, title="MACD Long", color=col_macd_long)
plot(signal_long, title="Signal Long", color=col_signal_long)

//Plot Short
plot(hist_short, title="Histogram Short", style=plot.style_columns, color=(hist_short>=0 ? (hist_short[1] < hist_short ? col_grow_above_short : col_fall_above_short) : (hist_short[1] < hist_short ? col_grow_below_short : col_fall_below_short)))
plot(macd_short, title="MACD Short", color=col_macd_short)
plot(signal_short, title="Signal Short", color=col_signal_short)

var detectedLongCrossOver = false
var detectedShortCrossUnder = false

detectedShortCrossUnder := true
detectedShortCrossUnder := false

detectedLongCrossOver := true
detectedLongCrossOver := false

crossover_signal_long = ta.crossover(signal_long,cross_point_long)
crossunder_signal_long = ta.crossunder(signal_long,cross_point_long)

crossunder_signal_short = ta.crossunder(signal_short,cross_point_short)
crossover_signal_short = ta.crossover(signal_short,cross_point_short)

crossover_macd_long = ta.crossover(macd_long,cross_point_long)
crossunder_macd_long = ta.crossunder(macd_long,cross_point_long)

crossunder_macd_short = ta.crossunder(macd_short,cross_point_short)
crossover_macd_short = ta.crossover(macd_short,cross_point_short)

inEntry = false
//Strategy Entries
if (strategy.equity > 0) //This is required for the input optimizer to work since it will fail if the strategy fails to succeed by not having enough equity.

if (strategy.position_size <= 0 and allow_long==true and inEntry==false)
longSignalCondition = detectedLongCrossOver==true and crossover_signal_long[cross_delay_signal_long]
strategy.entry(id="long", direction=strategy.long, when=longSignalCondition)
longMacDCondition = crossover_macd_long[cross_delay_macd_long]
strategy.entry(id="long", direction=strategy.long, when=longMacDCondition)
if (strategy.position_size >= 0 and allow_short==true and inEntry==false)
shortSignalCondition = detectedShortCrossUnder and crossunder_signal_short[cross_delay_signal_short]
strategy.entry(id="short", direction=strategy.short, when=shortSignalCondition)
shortMacDCondition = crossunder_macd_short[cross_delay_macd_short]
strategy.entry(id="short", direction=strategy.short, when=shortMacDCondition)
if(strategy.position_size > 0 and allow_long==true and allow_short==false)
strategy.close(id="long", when=detectedLongCrossOver==false and crossunder_signal_long)
strategy.close(id="long", when=crossunder_macd_long)
if(strategy.position_size < 0 and allow_short==true and allow_long==false)
strategy.close(id="short", when=detectedShortCrossUnder==false and crossover_signal_short)
strategy.close(id="short", when=crossover_macd_short)

stop_loss_value_long = strategy.position_avg_price*(1 - stop_loss_long_percentage)
take_profit_value_long = strategy.position_avg_price*(1 + take_profit_long_percentage)
stop_loss_value_short = strategy.position_avg_price*(1 + stop_loss_short_percentage)
take_profit_value_short = strategy.position_avg_price*(1 - take_profit_short_percentage)

if(strategy.position_size>0) //Long positions only
strategy.exit(id="TP/SL Long",from_entry="long", limit=use_take_profit_long ? take_profit_value_long : na, stop=use_stop_loss_long ? stop_loss_value_long : na)
if(strategy.position_size<0) //Short positions only
strategy.exit(id="TP/SL Short",from_entry="short", limit=use_take_profit_short ? take_profit_value_short : na, stop=use_stop_loss_short ? stop_loss_value_short : na)

Reply With Quote

Can you help answer these questions
from other members on futures io?
IKYP - How I solved email troubles on VPS
CME 2023 Fee Increases (MES +16%!)
Traders Hideout
Sierra Chart Teton_Denali vs TT Platform
Platforms and Indicators
strategy builder help
Traders Hideout
Asking Wall Street Billionaire for Investment Advice
Psychology and Money Management
Best Threads (Most Thanked)
in the last 7 days on futures io
1 Tick from the ES/Per day
18 thanks
What if a broker declare bankruptcy!!! Ftx first whose next?
12 thanks
Want your NinjaTrader indicator created, free?
8 thanks
HFT Algo: anyone doing HFT here?
8 thanks
top trading courses
7 thanks
(login for full post details)
  #2 (permalink)
Philadelphia PA
Experience: Advanced
Platform: Multicharts
Broker: Ironbeam, Rithmic
Trading: Emini ES / NQ / CL / RTY / YM / BTC
syswizard's Avatar
Posts: 344 since Jan 2019
Thanks: 20 given, 138 received

doko94 View Post
Could you help me to convert to easy language, i backtested in tradingview since 2012, gives me more than 400% but I want to test in easy language for get more data

Whew, that's a lot of code. I would say that Easy Language would be about 1/4 of that code size.

Reply With Quote

futures io Trading Community Platforms and Indicators EasyLanguage Programming > Could you help me to convert from pinescript to easy lenguaje

Last Updated on November 10, 2022

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada),
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts