답변완료
전환추세 거래량
Input : 전환(0.5);
Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL(0),TX(0),TX2(0),T(0);
Array:고[10,4](0),저[10,4](0);
HH = H;
LL = L;
If Index == 0 Then
{
고[1,1] = HH;
고[1,2] = 0;
고[1,3] = sDate;
고[1,4] = sTime;
저[1,1] = LL;
저[1,2] = 0;
저[1,3] = sDate;
저[1,4] = sTime;
}
If Index > 0 Then
{
hiBar = hiBar + 1;
loBar = loBar + 1;
}
If HH[hiBar] < HH Then hiBar = 0;
If LL[loBar] > LL Then loBar = 0;
Condition1 = 저[1,1]+전환 <= HH and hiBar == 0;
Condition2 = 고[1,1]-전환 >= LL and loBar == 0;
처리구분 = "";
If Condition1 and Condition2 Then
{
If 최종꼭지점 == "저점" Then
{
If 저[1,1] > LL Then 처리구분 = "저점처리";
Else 처리구분 = "고점처리";
}
Else If 최종꼭지점 == "고점" Then
{
If 고[1,1] < HH Then 처리구분 = "고점처리";
Else 처리구분 = "저점처리";
}
}
Else If Condition1 Then 처리구분 = "고점처리";
Else If Condition2 Then 처리구분 = "저점처리";
If 처리구분 == "고점처리" Then
{
If 최종꼭지점 == "저점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
고[j,jj] = 고[j-1,jj];
}
}
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
TL_SetSize(TL,2);
TL_SetColor(TL,RED);
T = 1;
}
Else If 고[1,1] < HH[hiBar] Then
{
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]);
Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2));
Text_SetLocation(TX,고[1,3],고[1,4],고[1,1]);
}
최종꼭지점 = "고점";
if MarketPosition >= 0 and T == 1 and 고[1,1] >= 저[1,1]+1 and V > 500 and V >= V[1]*2.5 Then
{
T = 2;
Sell();
}
}
If 처리구분 == "저점처리" Then
{
If 최종꼭지점 == "고점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
저[j,jj] = 저[j-1,jj];
}
}
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
TL = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
TL_SetSize(TL,2);
TL_SetColor(TL,BLUE);
T = -1;
}
Else If 저[1,1] > LL[loBar] Then
{
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
TL_SetEnd(TL,저[1,3],저[1,4],저[1,1]);
Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2));
Text_SetLocation(TX,저[1,3],저[1,4],저[1,1]);
}
최종꼭지점 = "저점";
if MarketPosition <= 0 and T == -1 and 저[1,1] <= 고[1,1]-1 and V > 500 and V >= V[1]*2.5 Then
{
T = -2;
Buy();
}
}
if MarketPosition == 1 and BarsSinceEntry == 1 Then
ExitLong();
if MarketPosition == -1 and BarsSinceEntry == 1 Then
ExitShort();
84235 재문의
한 추세선에 한번만 나오는 매매 신호를 조건이 맞으면 모두 나오게 부탁드립니다.
2023-10-24
961
글번호 173369
시스템
답변완료
문의 드립니다.
1분봉 차트에 money flow index 차트를 적용 시켰습니다.
기본 수치 14로 하면 트레이딩뷰 차트와 예스 차트에서는 모양이 동일합니다.
그런데 수치를 7로 바꿔주면 예스와 트레이딩뷰 차트 모양이 다르게 나옵니다.
수치를 바꿔을때도 트레이딩뷰와 동일하게 나오게 해주세요.
알람 수식등은 빼고 money flow index 수식만 바꿔주세요.
트레이딩뷰 수식입니다.
//@version=3
study("Money Flow Index MTF + Alerts", overlay = false)
////////////////////////////
// This study is based on the work of TV user Beasley Savage (https://www.tradingview.com/스크립트/g58H59ub-Money-Flow-Index-Beasley-Savage/)
// and all credit goes to them.
//
// Changes I've made:
//
// 1. Added a visual symbol of an overbought/oversold threshold cross in the form of a red/green circle, respectively.
// Sometimes it can be hard to see when a cross actually occurs, and if your scaling isn't set up properly you can get
// misleading visuals. This way removes all doubt. Bear in mind they aren't meant as trading signals, so DO NOT use them as such.
// Research the MFI if you're unsure, but I use them as an early warning and that particular market/stock is added to my watchlist.
//
// 2. Added 60/40 lines as the MFI respects these incredibly well in trends. E.g. in a solid uptrend the MFI won't go below 40,
// and vice versa. Use the idea of support and resistance levels on the indicator and it'll be a great help.
// I've coloured the zones. Strong uptrends should stay above 60, strong downtrends should stay below
// 40. The zone in between 40-60 I've called the transition zone. MFI often stays here in consolidation periods, and
// in the last leg of a cycle/trend the MFI will often 드롭 into this zone after being above 60 or below 40. This is a great
// sign that you should get out and start looking to reverse your position. Hopefully it helps to spot divergences as well.
//
// 3. Added alerts based on an overbought/oversold cross. Also added an alert for when either condition is triggered, so hopefully
// that's useful for those struggling with low alert limits. Feel free to change the overbought/oversold levels, the alerts +
// crossover visual are set to adapt.
//
// Any queries please comment or PM me.
//
// Cheers,
// RJR
//
////////////////////////////
// Version control
// ========================
// 1.0
// Initial Release
// 1.1
// Added support for multiple time frames
// Cleaned up code
// 1.1.1
// Minor error fix
////////////////////////////
//Inputs
length = input(title="Length", defval=14)
os = input(20, title="Oversold")
ob = input(80, title="Overbought")
CurrentRes = input(true, title="Use Current Chart Resolution?")
CustomRes = input("240", title="Custom Timeframe? Uncheck Box Above (E.g. 1M, 5D, 240 = 4Hours)")
//MFI Calc
res = CurrentRes ? period : CustomRes
rawMoneyFlow = hlc3 * volume
positiveMoneyFlow() =>
a = 0.0
a := hlc3 > hlc3[1] ? a + rawMoneyFlow : a
negativeMoneyFlow() =>
b = 0.0
b := hlc3 < hlc3[1] ? b + rawMoneyFlow : b
moneyFlowRatio = sma(positiveMoneyFlow(), length) / sma(negativeMoneyFlow(), length)
moneyFlowIndex = security(tickerid, res, 100 - 100 / (1 + moneyFlowRatio))
//OB/OS Identification
oversold = moneyFlowIndex[1] > os[1] and moneyFlowIndex < os
overbought = moneyFlowIndex[1] < ob[1] and moneyFlowIndex > ob
//Plotting
col = oversold ? green : red
plot(moneyFlowIndex, color=black, linewidth=2)
plot(oversold ? moneyFlowIndex : overbought ? moneyFlowIndex : na, title="Oversold/Overbought Cross", color=col, style=circles, linewidth=6)
h1 = hline(80, "Overbought")
h2 = hline(20, "Oversold")
h3 = hline(40, "Bears")
h4 = hline(60, "Bulls")
fill(h4, h1, color=green, title="Uptrend")
fill(h3, h2, color=red, title="Downtrend")
fill (h3, h4, color=gray, title="Transition Zone")
//Alerts
alert = oversold or overbought
alertcondition(oversold, title="MFI Oversold", message="MFI Crossed Oversold" )
alertcondition(overbought, title="MFI Overbought", message="MFI Crossed Overbought" )
alertcondition(alert, title="MFI Alert Both", message="MFI Alert Generated OB/OS" )
2023-10-24
1356
글번호 173367
지표
답변완료
문의 드립니다....
수고많으십니다 항상 많은 도움이 되고있습니다.
1분봉에서 현재봉이 2번이 검색되면서 전봉이 1번인 캔들이 검색되는식 부탁드립니다.
1번
var : a(0),b(0),d(0),d1(0),a1(0),b1(0),b2(0),a3(0),b3(0),b4(0),b5(0);
a=ma(c,5);
b=ma(c,20);
d=ma(c,60);
D1=(A+B+D)/3;
A1=(highest(high,9)+lowest(low,9))/2;
B1=(highest(high,26)+lowest(low,26))/2;
B2=(A1+B1)/2;
A3=RSI(9)-50;
B3=CMO(12)*0.5;
B4=A3+B3;
B5=Ema(C,120);
if (CROSSDOWN(B2,D1) OR CROSSDOWN(D1,B5) OR CROSSDOWN(B2,B5)) AND B4<0 AND bw(20,12,5,3)> -4 Then
Find(1);
2번
input : 배분1(0.236),배분2(1.02);
var : 중최고가(0),중최저가(0);
var : 경계(0),경계1(False),경계2(False);
var : 기준봉(0),기준봉1(False),기준봉2(False);
var : 결과기준(0),결과기준1(False),결과기준2(False);
var : 평균(0),평균라인(0);
var : a(0), m5(0),m10(0),m20(0),m60(0),m120(0),m240(0),m480(0);
var : bh(0),bc(0),b(0),aa(0);
중최고가=highest(h,20);
중최저가=lowest(l,20);
경계=(중최고가+중최저가)/2-(중최고가-중최저가)*배분1;
경계1=crossup(c, 경계)&& c>o*배분2;
경계2=crossdown(c, 경계);
if 경계1 or 경계2 Then
기준봉 = O;
기준봉1=crossup(c, 기준봉);
기준봉2=crossdown(c, 기준봉);
if 기준봉1 or 기준봉2 Then
결과기준=o;
결과기준1=crossup(c, 결과기준);
결과기준2=crossdown(c, 결과기준);
if 결과기준1 or 결과기준2 Then
A=o;
M5=ema(C,5);
M10=ema(C,10);
M20=ema(C,20);
M60=ema(C,60);
M120=ema(C,120);
M240=ema(C,240);
M480=ema(C,480);
BH=BollBandUp(20,2);
BC=ma(c,20);
평균=((M5*2)+(M10*2)+(M20*3)+(M60*2)+(M120*3)+(M240*2)+(M480*2)+(BH*1)+(BC*1)) / 18;
평균라인=Ema(Ema(Ema(평균, 5), 5), 5);
B=평균라인 + 20*std(평균라인,5);
AA=sar(0.02,0.2);
if C>=A && CROSSUP(C,B) && AA<=C Then
Find(1);
2023-10-24
622
글번호 173343
종목검색