커뮤니티
문의드립니다
2018-05-28 09:57:55
184
글번호 119235
수식 추가 부탁드립니다
아래식에서
거래시간 동안
1.
첫번째 매수 --> 청산.
두번째 매수는 첫번째 매수값과 +50틱 또는 -50틱 차이가 날때 두번째 매수 --> 청산
세번째 매수는 두번째 매수값과 +50틱 또는 -50틱 차이가 날때 세번째 매수 --> 청산
네번째, 다섯번째.... 동일
"Buy"에만 해당되며 "reBuy"는 상기 조건에 해당되지 않습니다
매도 반대
2.위의 ±50틱을 ±1% 로 해주세요
부탁드립니다
input : P1(3),P2(10),P3(180);
var : mav2(0),mav3(0);
input : 익절1(100),익절1하락(50),손절(80);
var : BH(0),SL(0),HE(0),LE(0);
input : 시작시간(1030000), 종료시간(050000);
var : Tcond(False);
#ATR
Input : ATR추적(20), ATR손절(20); #
Var : PosHigh(0), PosLow(0);
mav2 = ma(c,P2);
mav3 = ma(c,P3);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
//진입
if Tcond == true Then{
if crossup(mav2,mav3) Then
buy("Buy");
if CrossDown(mav2,mav3) Then
sell("Sell");
if MarketPosition == 0 and
MarketPosition(1) == 1 and
IsEntryName("Buy",1) == true and
IsExitName("B익절1",1) == true and
mav2 > mav3 and
mav2 > mav2[1] Then
buy("reBuy");
if MarketPosition == 0 and
MarketPosition(1) == -1 and
IsEntryName("Sell",1) == true and
IsExitName("S익절1",1) == true and
mav2 < mav3 and
mav2 < mav2[1] Then
sell("reSell");
}
//청산
if MarketPosition == 1 Then
{
BH = highest(H,BarsSinceEntry);
if MaxEntries == 1 Then
HE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then
HE = LatestEntryPrice(0);
if BH >= EntryPrice+PriceScale*익절1 Then
{
ExitLong("B익절1",AtStop,BH-PriceScale*익절1하락);
}
ExitLong("B손절",AtStop,HE-PriceScale*손절);
}
if MarketPosition == -1 Then
{
SL = Lowest(L,BarsSinceEntry);
if MaxEntries == 1 Then
LE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then
LE = LatestEntryPrice(0);
if SL <= EntryPrice-PriceScale*익절1 Then
{
ExitShort("S익절1",AtStop,SL+PriceScale*익절1하락);
}
ExitShort("S손절",AtStop,LE+PriceScale*손절);
}
답변 2
예스스탁 예스스탁 답변
2018-05-28 12:54:56
안녕하세요
예스스탁입니다.
input : P1(3),P2(10),P3(180);
var : mav2(0),mav3(0);
input : 익절1(100),익절1하락(50),손절(80);
var : BH(0),SL(0),HE(0),LE(0);
input : 시작시간(1030000), 종료시간(050000);
var : Tcond(False);
#ATR
Input : ATR추적(20), ATR손절(20); #
Var : PosHigh(0), PosLow(0),Bprice(0);
mav2 = ma(c,P2);
mav3 = ma(c,P3);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
Bprice = 0;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
if TotalTrades > TotalTrades[1] and MarketPosition == 1 Then{
Bprice = EntryPrice(1);
}
//진입
if Tcond == true Then
{
if crossup(mav2,mav3) Then
{
if Bprice == 0 or (Bprice > 0 and abs(C-Bprice) >= PriceScale*50 Then
buy("Buy");
}
if CrossDown(mav2,mav3) Then
sell("Sell");
if MarketPosition == 0 and
MarketPosition(1) == 1 and
IsEntryName("Buy",1) == true and
IsExitName("B익절1",1) == true and
mav2 > mav3 and
mav2 > mav2[1] Then
buy("reBuy");
if MarketPosition == 0 and
MarketPosition(1) == -1 and
IsEntryName("Sell",1) == true and
IsExitName("S익절1",1) == true and
mav2 < mav3 and
mav2 < mav2[1] Then
sell("reSell");
}
//청산
if MarketPosition == 1 Then
{
BH = highest(H,BarsSinceEntry);
if MaxEntries == 1 Then
HE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then
HE = LatestEntryPrice(0);
if BH >= EntryPrice+PriceScale*익절1 Then
{
ExitLong("B익절1",AtStop,BH-PriceScale*익절1하락);
}
ExitLong("B손절",AtStop,HE-PriceScale*손절);
}
if MarketPosition == -1 Then
{
SL = Lowest(L,BarsSinceEntry);
if MaxEntries == 1 Then
LE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then
LE = LatestEntryPrice(0);
if SL <= EntryPrice-PriceScale*익절1 Then
{
ExitShort("S익절1",AtStop,SL+PriceScale*익절1하락);
}
ExitShort("S손절",AtStop,LE+PriceScale*손절);
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 수식 추가 부탁드립니다
아래식에서
거래시간 동안
1.
첫번째 매수 --> 청산.
두번째 매수는 첫번째 매수값과 +50틱 또는 -50틱 차이가 날때 두번째 매수 --> 청산
세번째 매수는 두번째 매수값과 +50틱 또는 -50틱 차이가 날때 세번째 매수 --> 청산
네번째, 다섯번째.... 동일
"Buy"에만 해당되며 "reBuy"는 상기 조건에 해당되지 않습니다
매도 반대
2.위의 ±50틱을 ±1% 로 해주세요
부탁드립니다
input : P1(3),P2(10),P3(180);
var : mav2(0),mav3(0);
input : 익절1(100),익절1하락(50),손절(80);
var : BH(0),SL(0),HE(0),LE(0);
input : 시작시간(1030000), 종료시간(050000);
var : Tcond(False);
#ATR
Input : ATR추적(20), ATR손절(20); #
Var : PosHigh(0), PosLow(0);
mav2 = ma(c,P2);
mav3 = ma(c,P3);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
//진입
if Tcond == true Then{
if crossup(mav2,mav3) Then
buy("Buy");
if CrossDown(mav2,mav3) Then
sell("Sell");
if MarketPosition == 0 and
MarketPosition(1) == 1 and
IsEntryName("Buy",1) == true and
IsExitName("B익절1",1) == true and
mav2 > mav3 and
mav2 > mav2[1] Then
buy("reBuy");
if MarketPosition == 0 and
MarketPosition(1) == -1 and
IsEntryName("Sell",1) == true and
IsExitName("S익절1",1) == true and
mav2 < mav3 and
mav2 < mav2[1] Then
sell("reSell");
}
//청산
if MarketPosition == 1 Then
{
BH = highest(H,BarsSinceEntry);
if MaxEntries == 1 Then
HE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then
HE = LatestEntryPrice(0);
if BH >= EntryPrice+PriceScale*익절1 Then
{
ExitLong("B익절1",AtStop,BH-PriceScale*익절1하락);
}
ExitLong("B손절",AtStop,HE-PriceScale*손절);
}
if MarketPosition == -1 Then
{
SL = Lowest(L,BarsSinceEntry);
if MaxEntries == 1 Then
LE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then
LE = LatestEntryPrice(0);
if SL <= EntryPrice-PriceScale*익절1 Then
{
ExitShort("S익절1",AtStop,SL+PriceScale*익절1하락);
}
ExitShort("S손절",AtStop,LE+PriceScale*손절);
}
라떼처럼
2018-05-28 14:53:19
수식이 요청사항과 달라 다시 요청드립니다.
1계약이며, 거래시간 동안 이전 매수, 매도 진입 값을 기억하고 두번째 진입시 조건 만족시 매수 매도 진입하는 것입니다.
거래시간 동안
1.
Crossup(mav2,nmav3) ⓐ첫번째 매수진입값 --> 청산 또는 Crossdown(mav2,nmav3)에 의한 전환.
ⓑ두번째 Crossup(mav2,nmav3) 매수진입은
ⓐ첫번째 매수진입값과 ±50 차이가 날때만 매수 진입 -->청산 또는 Crossdown(mav2,nmav3)에 의한 전환
ⓒ세번째 진입은 ⓑ두번째 매수진입값 참조, ⓓ네번째 진입은 ⓒ세번째 매수 진입값 참조....,...
"Buy"에만 해당되며 "reBuy"는 상기 조건에 해당되지 않습니다
매도 쪽도 같은식으로 추가 부탁드립디다
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 문의드립니다
>
안녕하세요
예스스탁입니다.
input : P1(3),P2(10),P3(180);
var : mav2(0),mav3(0);
input : 익절1(100),익절1하락(50),손절(80);
var : BH(0),SL(0),HE(0),LE(0);
input : 시작시간(1030000), 종료시간(050000);
var : Tcond(False);
#ATR
Input : ATR추적(20), ATR손절(20); #
Var : PosHigh(0), PosLow(0),Bprice(0);
mav2 = ma(c,P2);
mav3 = ma(c,P3);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
Bprice = 0;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
if TotalTrades > TotalTrades[1] and MarketPosition == 1 Then{
Bprice = EntryPrice(1);
}
//진입
if Tcond == true Then
{
if crossup(mav2,mav3) Then
{
if Bprice == 0 or (Bprice > 0 and abs(C-Bprice) >= PriceScale*50 Then
buy("Buy");
}
if CrossDown(mav2,mav3) Then
sell("Sell");
if MarketPosition == 0 and
MarketPosition(1) == 1 and
IsEntryName("Buy",1) == true and
IsExitName("B익절1",1) == true and
mav2 > mav3 and
mav2 > mav2[1] Then
buy("reBuy");
if MarketPosition == 0 and
MarketPosition(1) == -1 and
IsEntryName("Sell",1) == true and
IsExitName("S익절1",1) == true and
mav2 < mav3 and
mav2 < mav2[1] Then
sell("reSell");
}
//청산
if MarketPosition == 1 Then
{
BH = highest(H,BarsSinceEntry);
if MaxEntries == 1 Then
HE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then
HE = LatestEntryPrice(0);
if BH >= EntryPrice+PriceScale*익절1 Then
{
ExitLong("B익절1",AtStop,BH-PriceScale*익절1하락);
}
ExitLong("B손절",AtStop,HE-PriceScale*손절);
}
if MarketPosition == -1 Then
{
SL = Lowest(L,BarsSinceEntry);
if MaxEntries == 1 Then
LE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then
LE = LatestEntryPrice(0);
if SL <= EntryPrice-PriceScale*익절1 Then
{
ExitShort("S익절1",AtStop,SL+PriceScale*익절1하락);
}
ExitShort("S손절",AtStop,LE+PriceScale*손절);
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 수식 추가 부탁드립니다거래시간 동안
1.
첫번째 매수 --> 청산.
두번째 매수는 첫번째 매수값과 +50틱 또는 -50틱 차이가 날때 두번째 매수 --> 청산
세번째 매수는 두번째 매수값과 +50틱 또는 -50틱 차이가 날때 세번째 매수 --> 청산
네번째, 다섯번째.... 동일
"Buy"에만 해당되며 "reBuy"는 상기 조건에 해당되지 않습니다
아래식에서
매도 반대
2.위의 ±50틱을 ±1% 로 해주세요
부탁드립니다
input : P1(3),P2(10),P3(180);
var : mav2(0),mav3(0);
input : 익절1(100),익절1하락(50),손절(80);
var : BH(0),SL(0),HE(0),LE(0);
input : 시작시간(1030000), 종료시간(050000);
var : Tcond(False);
#ATR
Input : ATR추적(20), ATR손절(20); #
Var : PosHigh(0), PosLow(0);
mav2 = ma(c,P2);
mav3 = ma(c,P3);
if stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
}
if stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간) Then{
Tcond = false;
}
//진입
if Tcond == true Then{
if crossup(mav2,mav3) Then
buy("Buy");
if CrossDown(mav2,mav3) Then
sell("Sell");
if MarketPosition == 0 and
MarketPosition(1) == 1 and
IsEntryName("Buy",1) == true and
IsExitName("B익절1",1) == true and
mav2 > mav3 and
mav2 > mav2[1] Then
buy("reBuy");
if MarketPosition == 0 and
MarketPosition(1) == -1 and
IsEntryName("Sell",1) == true and
IsExitName("S익절1",1) == true and
mav2 < mav3 and
mav2 < mav2[1] Then
sell("reSell");
}
//청산
if MarketPosition == 1 Then
{
BH = highest(H,BarsSinceEntry);
if MaxEntries == 1 Then
HE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) > HE Then
HE = LatestEntryPrice(0);
if BH >= EntryPrice+PriceScale*익절1 Then
{
ExitLong("B익절1",AtStop,BH-PriceScale*익절1하락);
}
ExitLong("B손절",AtStop,HE-PriceScale*손절);
}
if MarketPosition == -1 Then
{
SL = Lowest(L,BarsSinceEntry);
if MaxEntries == 1 Then
LE = LatestEntryPrice(0);
if MaxEntries >= 2 and LatestEntryPrice(0) < LE Then
LE = LatestEntryPrice(0);
if SL <= EntryPrice-PriceScale*익절1 Then
{
ExitShort("S익절1",AtStop,SL+PriceScale*익절1하락);
}
ExitShort("S손절",AtStop,LE+PriceScale*손절);
}