Re: Already Converted TradingView Indicators to MT4 Indicators

471
Hey guys hope everyone is having a wonderful weekend. I just needed to ask for a tradingview pine script conversion to mql4. Reason is the indicator is really good for establishing very great support and resistance level during early market hours and during the rest of the trading session. Here is the publication link to the indicator https://www.tradingview.com/script/fcUx ... wMidLines/ and i will also include the source code below. Anyone please help. I will truly appreciate the help. Anyone please help.

Code: Select all

//@version=4

study("AsiaSessionHighLowMidLines", overlay=true)

// INPUT    {
maType ="Static"
tradeRange = input("1800-0200", "Session", input.session)
rColor = input(color.aqua, title="Level Color")
rStyle = input(line.style_solid, title="Level Style", options = [line.style_solid, line.style_dotted, line.style_dashed, line.style_arrow_both, line.style_arrow_left, line.style_arrow_right])
rWidth = input(1, title="Level Width")
mColor = input(color.orange, title="MA Level Color")
mStyle = input(line.style_solid, title="MA Level Style", options = [line.style_solid, line.style_dotted, line.style_dashed, line.style_arrow_both, line.style_arrow_left, line.style_arrow_right])
mWidth = input(1, title="MA Level Width")
bgColor = input(color.new(color.aqua,70), title = "Background Color")
//} INPUT

// INIT     {
timeIsAllowed = not na(time(timeframe.period, tradeRange))
newSession = timeIsAllowed and not timeIsAllowed[1]

var float refHigh = na, refHigh := timeIsAllowed and not timeIsAllowed[1] ? high : timeIsAllowed and timeIsAllowed[1] ? high > refHigh ? high : refHigh : refHigh
var float refLow = na,  refLow  := timeIsAllowed and not timeIsAllowed[1] ? low : timeIsAllowed and timeIsAllowed[1] ? low < refLow ? low : refLow : refLow
var int x = na, x := newSession ? time : x

var int l01_x1_s1 = na, var int l01_x2_s1 = na, var float l01_y1_s1 = na, var float l01_y2_s1 = na
var int l02_x1_s1 = na, var int l02_x2_s1 = na, var float l02_y1_s1 = na, var float l02_y2_s1 = na
var int ma_x1 = na, var int ma_x2 = na, var float ma_y1 = na, var float ma_y2 = na


var int l01_x1_v1 = na, var int l01_x2_v1 = na, var float l01_y1_v1 = na, var float l01_y2_v1 = na
var int l02_x1_v1 = na, var int l02_x2_v1 = na, var float l02_y1_v1 = na, var float l02_y2_v1 = na

var l01 = line(na), var l01_s1 = line(na),  var l01_v1 = line(na),
var l02 = line(na), var l02_s1 = line(na),  var l02_v1 = line(na),
var l03 = line(na),
var l04 = line(na)
var maLine = line(na)
var box1 = box(na)
var boxCur = box(na)

var int counter = 0
var float sum = na
var float ma = na
//} INIT

// LOGIC    {

// previous sessions
if newSession
    counter := 1
    sum := close
    ma := sum / counter
    l01_s1 := 
         line.new(
          x1    = l01_x1_s1, 
          y1    = l01_y1_s1, 
          x2    = l01_x2_s1, 
          y2    = l01_y2_s1, 
          xloc  = xloc.bar_time, 
          color = rColor, 
          width = rWidth, 
          style = rStyle
          )
    l02_s1 := 
         line.new(
          x1    = l02_x1_s1, 
          y1    = l02_y1_s1, 
          x2    = l02_x2_s1, 
          y2    = l02_y2_s1, 
          xloc  = xloc.bar_time, 
          color = rColor, 
          width = rWidth, 
          style = rStyle
          )
     // Draw the box
    boxCur := box.new(l01_x1_s1, l01_y1_s1, l01_x2_s1-8*60*60*1000, l02_y2_s1,color.white, 0 ,line.style_solid, extend.none,xloc.bar_time,bgColor)
    
    if maType == "Static"
        maLine :=
         line.new(
          x1    = (l01_x1_s1+l02_x1_s1)/2, 
          y1    = (l01_y1_s1+l02_y1_s1)/2, 
          x2    = (l01_x2_s1+l02_x2_s1)/2, 
          y2    = (l01_y2_s1+l02_y2_s1)/2, 
          xloc  = xloc.bar_time, 
          color = rColor, 
          width = rWidth, 
          style = rStyle
          )        

// current session
if timeIsAllowed and not newSession
    counter := counter + 1
    sum := sum + close
    ma := sum / counter
    line.delete(l01)
    line.delete(l02)
    line.delete(l03)
    line.delete(l04)
    line.delete(maLine)
    box.delete(box1)
    l01 := 
         line.new(
          x1    = x, 
          y1    = refHigh, 
          x2    = time+8*60*60*1000, 
          y2    = refHigh, 
          xloc  = xloc.bar_time, 
          color = rColor, 
          width = rWidth, 
          style = rStyle
          )        
    l02 :=
         line.new(
          x1    = x, 
          y1    = refLow, 
          x2    = time+8*60*60*1000, 
          y2    = refLow, 
          xloc  = xloc.bar_time, 
          color = rColor, 
          width = rWidth, 
          style = rStyle
          )
    if maType == "Static"
        maLine :=
         line.new(
          x1    = x, 
          y1    = (refHigh+refLow)/2, 
          x2    = time+8*60*60*1000, 
          y2    = (refHigh+refLow)/2, 
          xloc  = xloc.bar_time, 
          color = mColor, 
          width = mWidth, 
          style = mStyle
          )
     // Draw the box
    box1 := box.new(x, refHigh, time, refLow,color.white, 0 ,line.style_solid, extend.none,xloc.bar_time,bgColor)
    
// set previous values
if not timeIsAllowed and timeIsAllowed[1] and not newSession
    ma := na
    l01_x1_s1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_x1(l01), 0)
    l01_x2_s1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_x2(l01), 0)
    l01_y1_s1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_y1(l01), 0)
    l01_y2_s1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_y2(l01), 0)
    l02_x1_s1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_x1(l02), 0)
    l02_x2_s1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_x2(l02), 0)
    l02_y1_s1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_y1(l02), 0)
    l02_y2_s1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_y2(l02), 0)
    ma_x1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_x1(maLine), 0)
    ma_y1 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_y1(maLine), 0)
    ma_x2 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_x2(maLine), 0)
    ma_y2 := valuewhen(not timeIsAllowed and timeIsAllowed[1] and not newSession, line.get_y2(maLine), 0)
//} LOGIC



https://www.tradingview.com/script/fcUx ... wMidLines/




ChartRe: Already Converted TradingView Indicators to MT4 Indicators

476
YeungKwan wrote: Tue Nov 12, 2024 6:59 pm Mr tools! This is a good indicator. please convert this indicator to mt4. thank you very much
Market Structure Oscillator

The Market Structure Oscillator indicator looks at changes in market structure over different time frames, including short-term, intermediate-term, and long-term. It shows this information as oscillators and graphs on the main price chart, making it easier to see what's happening in real-time.

By presenting the market structures as oscillators, traders can better understand the momentum and strength of trends. This helps them spot possible trend reversals and offers new insights to improve their analysis of traditional market structures.

The on-chart structures are labelled as:
  • Breaks of Structure (BoS) which signifies the continuation of the existing market trend
  • Change of Character (CHoCH) suggests a potential shift in market sentiment or direction
The indicator analyzes price patterns using a price action methodology and identifies market structures across various timeframes. The data is then normalized and weighted to produce the final value of the Market Structure Oscillator.

Here you go. It was easy to check on Lux Algo website.
"I conjure from shadows and shape fortunes from the unseen. The treasure lies hidden in plain sight, beneath the sunlight." - Cagliostro

Re: Already Converted TradingView Indicators to MT4 Indicators

478
Cagliostro wrote: Tue Nov 12, 2024 7:07 pm Market Structure Oscillator

Here you go. It was easy to check on Lux Algo website.
Outstanding work Cagliostro. This indicator you've released is packed with many features and the (BoS) Break of Structure plus Change of Character (CHoCH) is absolutely spot-on. One of the best conversions this year 👍
These users thanked the author ChuChu Rocket for the post:
boytoy

Re: Already Converted TradingView Indicators to MT4 Indicators

479
Cagliostro wrote: Tue Nov 12, 2024 7:07 pm Here you go. It was easy to check on Lux Algo website.
Jaw dropping.... this is an ubelievable conversion and one of those "does it all" indicators..... could you allow us to edit the widths of the lines and bars perhaps? 🙏

Your Market Structure Oscillator and the BBPT are my two favorite indicators of 2024 🙌
These users thanked the author boytoy for the post:
Jimmy