Other software create all indicators and strategies, like Optuma, TradingView etc...
Why not?
So, if someone could here codded this to ninja 8, I appreciate.
I let code for some Sofwares to see what is better understand to coded for Ninja.
Thanks in advance.
//@version=5 indicator( 'TASC 2023.02 Intrabar Efficiency Ratio', 'IER (TASC)', false, precision = 4)
// Libraries used by the script. import PineCoders/Time/3 as PCtime import PineCoders/lower_tf/3 as PCltf
//#region ———————————————————— Constants and Inputs
// ————— Constants
// Colors color GRAY = #80808080 color GRAY_LT = #f5f3f3
// Strings string ltfString = "2" string TAB_TXT = "Uses intrabars at {0}\nAvg intrabars per chart bar: {1,number,#.#}\nChart bars covered: {2} of {3}"
// Error Messages
string NI_ERR1 =
"No intrabar information exists at the '{0}' timeframe."
string NI_ERR2 = "This script uses intrabars;
the chart's timeframe must be >= 5min."
// ————— Inputs
string in10 = "Line"
string in11 = "Fill"
string in12 = "12"
string in20 = "20"
color icLine1 = input.color(#00BCD4AA, in10, "", in10)
color icLine2 = input.color(#FF5252AA, "", "", in10)
int lenInput = input.int(20, "Length", inline = in10)
color icFill1 = input.color(#00BCD4AA, in11, "", in11)
color icFill2 = input.color(#fffc52aa, "", "", in11)
color icFill3 = input.color(#FF5252AA, "", "", in11)
bool rankWeightInput = input.bool(false,
"Weigh using relative close changes", "", in12)
int rankLengthInput = input.int(100, "", inline = in12)
bool showInfoBoxInput = input.bool(true, "Show information box")
string infoBoxSizeInput = input.string("small", "Size",
["tiny","small","normal","large","huge","auto"], "", in20)
string infoBoxYPosInput = input.string("bottom","↕",
["top","middle","bottom"], "", in20)
string infoBoxXPosInput = input.string("left", "↔",
["left", "center", "right"], "", in20)
color infoBoxColorInput = input.color(GRAY, "", "", in20)
color infoBoxTxtColorInput = input.color(GRAY_LT, "T",
"", in20)
//#endregion
//#region ————————————————————
Calculations
// ———— IER
// Get array of 'close' to 'close' changes in intrabars.
array<float> travels = request.security_lower_tf(
syminfo.tickerid, ltfString, math.abs(ta.change(close)))
float totalTravels = array.sum(travels)
// Get 'close' to 'close' change of the chart's last two bars.
float chartBarChange = nz(ta.change(close))
// Weight on relative size of the 'close' to 'close' change.
float weight = switch
rankWeightInput => ta.percentrank(
math.abs(chartBarChange), rankLengthInput) /
100.0
=> 1.0
// Calculate IER and its MA.
float ier = nz(chartBarChange / totalTravels) * weight
float maMid = ta.alma(ier, lenInput, 0.85, 6)
// ———— Intrabar stats
[intrabars, chartBarsCovered, avgIntrabars] =
PCltf.ltfStats(travels)
int chartBars = bar_index + 1
//#endregion
//#region ———————————————————— Visuals
plotStyle1 = plot.style_line
plotStyle2 = plot.style_linebr
plotDN = display.none
var float mR = 0.0
mR := math.max(nz(mR), math.abs(maMid)) * 0.6
float upper = math.max(0, maMid)
float lower = math.min(0, maMid)
grad = color.from_gradient(maMid, -mR, mR, icLine1,
icLine2)
plot(maMid, "Mid MA", grad, 1, plotStyle1)
plot(maMid, "Mid MA", color.new(grad, 75), 3, plotStyle1)
P1 = plot(upper, "", grad, 1, plotStyle2, display = plotDN)
P2 = plot(lower, "", grad, 1, plotStyle2, display = plotDN)
TSW = maMid >= 0
cUP = TSW ? icFill2 : icFill3
cLO = TSW ? icFill1 : icFill2
fill(P1, P2, TSW ? mR : 0, TSW ? 0 : -mR, cLO, cUP, "")
hline(0)
// Information box.
if showInfoBoxInput
var table infoBox = table.new(infoBoxYPosInput + "_" +
infoBoxXPosInput, 1, 1)
string formattedLtf = PCtime.formattedNoOfPeriods(
timeframe.in_seconds(ltfString) * 1000)
string txt = str.format(TAB_TXT, formattedLtf,
avgIntrabars, chartBarsCovered, chartBars)
if barstate.isfirst
table.cell(infoBox, 0, 0, txt,
text_color = infoBoxTxtColorInput,
text_size = infoBoxSizeInput,
bgcolor = infoBoxColorInput)
else if barstate.islast
table.cell_set_text(infoBox, 0, 0, txt)
// Runtime errors.
if ta.cum(intrabars) == 0 and barstate.islast
runtime.error(str.format(NI_ERR1, ltfString))
else if timeframe.in_seconds() < 5 * 60
runtime.error(NI_ERR2)
//#endregion
tradingview.com/script/o8tRZCzT-Intrabar-Efficiency-Ratio.
---------------------------------------------------------------
OPTUMA: FEBRUARY 2023 TRADERS’ TIPS CODE
One of the more interesting techniques that we find
in W.D. Gann’s original hand-drawn charts is that he often plotted the position of planets that he thought were influential to that security—what we call Gann planetary lines (GPLs). The method he used was to take the planet’s longitudinal angle (from either a heliocentric or geocentric perspective) and convert it into a price using a scaling factor to have it display in the appropriate price range. This means that 180 degrees could be plotted at $1.80, $18.00, $1800, or even 18c. The next level is then plotted 360 degrees away ($3.60, $36.00, etc. depending on the scaling). The example in Figure 5 shows the 180-degree GPLs of Mars (in red). Gann planetary line alerts When looking at these plots, there are times when they behave as very effective support and resistance lines. Alan Oliver (TradingWithGann.com) has done a detailed study on these lines and which planets work best with which markets. The difficult part has always been to get alerted when price is approaching one of these levels (see Figure 5). For Optuma clients with the Astro module, the following script can do just that: P1=PVAL(PLANET=[Mars]); G1=GPA(); ASPECTS(P1, G1, ORB=20.0, ASPECTS=[Conjunction,O pposition], EXACT=False) The first line of code gets the planet’s angle for each day (i.e., Mars). The second line of code is a new function that turns price into an angle based on the GPL rules. You can set your own scaling unit in this, but leaving them set to “auto” means it can scan lots of different securities. The final “ASPECTS” function takes the angles and the price angles (P1 & G1) and allows us to set a tolerance— or orb—and the aspects to be considered (you can do all of them, with “conjunction” being 360 degrees, “opposition” at 180 degrees, “square” at 90 degrees, and so on). This can then also be used in scans to find any security that is coming up against one of these planetary lines. —[email protected]
.-.-.-
ESIGNAL: FEBRUARY 2023 TRADERS’ TIPS CODE
Comment