Initial Commit ...

This commit is contained in:
2024-01-25 04:07:49 +03:30
commit e24b73106d
76 changed files with 9457 additions and 0 deletions
@@ -0,0 +1,84 @@
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © exlux99
//@version=4
strategy(title="High/Low channel swing", shorttitle="Multi MA swing", overlay=true)
fromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = "From Month", minval = 1, maxval = 12)
fromYear = input(defval = 2000, title = "From Year", minval = 1970)
//monday and session
// To Date Inputs
toDay = input(defval = 31, title = "To Day", minval = 1, maxval = 31)
toMonth = input(defval = 12, title = "To Month", minval = 1, maxval = 12)
toYear = input(defval = 2021, title = "To Year", minval = 1970)
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = time >= startDate and time <= finishDate
//////
length_ma= input(defval=12, title="Length Moving averages", minval=1)
////////////////////////////////SETUP///////////////////////////////////////////
sma_high = sma(high, length_ma)
ema_high = ema(high, length_ma)
wma_high = wma(high, length_ma)
alma_high = alma(high,length_ma, 0.85, 6)
smma_high = rma(high,length_ma)
lsma_high = linreg(high, length_ma, 0)
vwma_high = vwma(high,length_ma)
avg_high = (sma_high+ema_high+wma_high+alma_high+smma_high+lsma_high+vwma_high)/7
///////////////////////////////////////////
sma_low = sma(low, length_ma)
ema_low = ema(low, length_ma)
wma_low = wma(low, length_ma)
alma_low = alma(low,length_ma, 0.85, 6)
smma_low = rma(low,length_ma)
lsma_low = linreg(low, length_ma, 0)
vwma_low = vwma(low,length_ma)
avg_low = (sma_low+ema_low+wma_low+alma_low+smma_low+lsma_low+vwma_low)/7
////////////////////////////PLOTTING////////////////////////////////////////////
plot(avg_high , title="avg", color=color.green, linewidth = 4)
plot(avg_low , title="avg", color=color.red, linewidth = 4)
long= close > avg_high
short = close < avg_low
tplong=input(0.06, title="TP Long", step=0.01)
sllong=input(0.05, title="SL Long", step=0.01)
tpshort=input(0.045, title="TP Short", step=0.01)
slshort=input(0.05, title="SL Short", step=0.01)
if(time_cond)
strategy.entry("long",1,when=long)
strategy.exit("closelong", "long" , profit = close * tplong / syminfo.mintick, loss = close * sllong / syminfo.mintick, alert_message = "closelong")
strategy.close("long", when=crossunder(low,avg_low))
strategy.entry("short",0,when=short)
strategy.exit("closeshort", "short" , profit = close * tpshort / syminfo.mintick, loss = close * slshort / syminfo.mintick, alert_message = "closeshort")
strategy.close("short",when=crossover(high,avg_high))