Random Market «NoaTrader»
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © NoaTrader

//@version=5
indicator("Random Market «NoaTrader»",overlay = false)

var start = input.float(1000,"Start Value")
var devider_max = input.float(100,"Devider Max")
var use_random_seed = input.bool(true,"Use Random Seed?")
var random_seed = input.int(1,"Random Seed")

var o = 0.0
var h = 0.0
var l = 0.0
var c = 0.0

if o == 0.0
    o := start
else
    o := c[1]


devider = use_random_seed ? math.random(devider_max/2,devider_max,random_seed) : math.random(devider_max/2,devider_max)
highest_random = use_random_seed ?  math.random(0,int(o/devider),random_seed+1) : math.random(0,int(o/devider))
lowest_random = use_random_seed ?  math.random(-int(o/devider),0,random_seed+2) : math.random(-int(o/devider),0)
oc = use_random_seed ?  math.random(lowest_random,highest_random,random_seed+3) : math.random(lowest_random,highest_random)

c := o + oc
h := o + oc + (use_random_seed ? math.random(oc,highest_random,random_seed+4) :  math.random(oc,highest_random))
l := o - (use_random_seed ?  math.random(-lowest_random,-oc,random_seed+5) : math.random(-lowest_random,-oc))

candle_color = o < c ? color.green : color.red
plotcandle(o,h,l,c,color = candle_color , bordercolor = candle_color,wickcolor = candle_color)