AQ ema200 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © nkqforex2021

//@version=5
indicator("AQ ema for XAUUSD")
string symbol=syminfo.ticker
Ema_value=input(defval = 200)
//float m1_rank=input.float(defval = 16)
m1_rank=switch symbol
    "EURUSD"=>0.006
    "GBPUSD"=>0.011
    "USDJPY"=>1.4
    "XAUUSD"=>17
    "AUDUSD"=>0.006
    "USDCAD"=>0.006
    "USDCHF"=>0.008
    "NZDUSD"=>0.006
    "GBPJPY"=>1.690

//float m2_rank=input.float(defval = 25)
m2_rank=switch symbol
    "EURUSD"=>0.008
    "GBPUSD"=>0.016
    "USDJPY"=>2
    "XAUUSD"=>24
    "AUDUSD"=>0.008
    "USDCAD"=>0.009
    "USDCHF"=>0.011
    "NZDUSD"=>0.008
    "GBPJPY"=>2.510
//float Stoplevel=input.float(defval = 34)
Stoplevel=switch symbol
    "EURUSD"=>m1_rank*2
    "GBPUSD"=>m1_rank*2
    "USDJPY"=>m1_rank*2
    "XAUUSD"=>m1_rank*2
    "AUDUSD"=>m1_rank*2
    "USDCAD"=>m1_rank*2
    "USDCHF"=>m1_rank*2
    "NZDUSD"=>m1_rank*2
    "GBPJPY"=>m1_rank*2
color a=color.green
h=high
c=low
float k=0
ema=ta.ema(close,Ema_value)
if h>ema
    k:=h-ema
    
else
    k:=c-ema
    a:=color.red

plot(k,"signal",a)
plot(0,"midle",color.rgb(82, 76, 76))
plot((m1_rank),"top5m",color.rgb(14, 87, 17))
plot((m1_rank)*(-1),"bot5m",color.rgb(33, 83, 33))
plot((m2_rank),"top15m",color.rgb(124, 117, 41))
plot((m2_rank)*(-1),"bot15m",color.rgb(126, 119, 44))
plot((Stoplevel),"toph1",color.red)
plot((Stoplevel)*(-1),"both1",color.red)
