커뮤니티
수정 부탁드립니다.
2018-05-30 12:51:26
134
글번호 119361
시작 시간 전 발생한 진입 조건 신호는 무시하고
장 시작 후 발생한 진입 조건에 의한 진입이 될 수 있게 수정 부탁드립니다.
input : n(30),P1(180), P2(10);
var : mav1(0),t(0),t1(0),tx(0),tl(0);
var1 = ma(c,P2);
var2 = ma(C,P1);
input : 익절1(30),익절1하락(10),손절(30);
input : 시작시간(070100),진입종료(055000);
input : short(12),long(26),sig(9), af(0.02),maxaf(0.1);
var : BH(0),SL(0),para(0),HE(0),LE(0);
var : N1(0),daypl(0),Xcond(false),Tcond(false);
var1 = ma(c,P2);
var2 = ma(C,P1);
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
N1 = NetProfit;
Xcond = false;
}
if stime == 진입종료 or (stime > 진입종료 and stime[1] < 진입종료) Then{
Tcond = false;
}
if TotalTrades > TotalTrades[1] and
(IsExitName("BB목표수익",1) == true or IsExitName("SS목표수익",1) == true) then
Xcond = true;
daypl = NetProfit-N1;
if Crossup(C,var2) Then
{
t = 1;
t1 = t[1];
tx = Text_New(sdate,stime,H+PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
Condition1 = false;
}
if CrossDown(C,var2) Then
{
t = -1;
t1 = t[1];
tx = Text_New(sdate,stime,L-PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
Condition2 = false;
}
if t == 1 and c > var2+PriceScale*n Then
{
t = 2;
tx = Text_New(sdate,stime,H+PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
}
if t == -1 and c < var2-PriceScale*n Then{
t = -2;
tx = Text_New(sdate,stime,L-PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
}
if crossup(t,0) and t1 <= -2 Then
{
tx = Text_New(sdate,stime,H+PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,YELLOW);
}
if CrossDown(t,0) and t1 >= 2 Then
{
tx = Text_New(sdate,stime,L-PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,YELLOW);
}
if Tcond == True then{
if Condition1 == false and t > 0 and t1 <= -2 and var1 > var2 and Xcond == false Then{
Condition1 = true;
buy("BB");
}
if Condition2 == false and t < 0 and t1 >= 2 and var1 < var2 and Xcond == false Then{
Condition2 = true;
sell("SS");
}
}
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*손절);
ExitLong("BB목표수익",atlimit,EntryPrice+((PriceScale*20-daypl)/CurrentContracts));
}
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*손절);
ExitShort("SS목표수익",atlimit,EntryPrice-((PriceScale*20-daypl)/CurrentContracts));
}
- 1. 문의_진입.jpg (0.11 MB)
답변 1
예스스탁 예스스탁 답변
2018-05-31 10:42:53
안녕하세요
예스스탁입니다.
input : n(30),P1(180), P2(10);
var : mav1(0),t(0),t1(0),tx(0),tl(0);
var1 = ma(c,P2);
var2 = ma(C,P1);
input : 익절1(30),익절1하락(10),손절(30);
input : 시작시간(070100),진입종료(055000);
input : short(12),long(26),sig(9), af(0.02),maxaf(0.1);
var : BH(0),SL(0),para(0),HE(0),LE(0);
var : N1(0),daypl(0),Xcond(false),Tcond(false),upcond(false),dncond(false);
var1 = ma(c,P2);
var2 = ma(C,P1);
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then
{
Tcond = true;
N1 = NetProfit;
Xcond = false;
upcond = false;
dncond = false;
}
if stime == 진입종료 or (stime > 진입종료 and stime[1] < 진입종료) Then
{
Tcond = false;
}
if TotalTrades > TotalTrades[1] and
(IsExitName("BB목표수익",1) == true or IsExitName("SS목표수익",1) == true) then
Xcond = true;
daypl = NetProfit-N1;
if Crossup(C,var2) Then
{
upcond = true;
t = 1;
t1 = t[1];
tx = Text_New(sdate,stime,H+PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
Condition1 = false;
}
if CrossDown(C,var2) Then
{
dncond = true;
t = -1;
t1 = t[1];
tx = Text_New(sdate,stime,L-PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
Condition2 = false;
}
if t == 1 and c > var2+PriceScale*n Then
{
t = 2;
tx = Text_New(sdate,stime,H+PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
}
if t == -1 and c < var2-PriceScale*n Then{
t = -2;
tx = Text_New(sdate,stime,L-PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
}
if crossup(t,0) and t1 <= -2 Then
{
tx = Text_New(sdate,stime,H+PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,YELLOW);
}
if CrossDown(t,0) and t1 >= 2 Then
{
tx = Text_New(sdate,stime,L-PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,YELLOW);
}
if Tcond == True then
{
if Condition1 == false and t > 0 and t1 <= -2 and var1 > var2
and Xcond == false and upcond == true Then{
Condition1 = true;
buy("BB");
}
if Condition2 == false and t < 0 and t1 >= 2 and var1 < var2
and Xcond == false and dncond == true Then{
Condition2 = true;
sell("SS");
}
}
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*손절);
ExitLong("BB목표수익",atlimit,EntryPrice+((PriceScale*20-daypl)/CurrentContracts));
}
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*손절);
ExitShort("SS목표수익",atlimit,EntryPrice-((PriceScale*20-daypl)/CurrentContracts));
}
즐거운 하루되세요
> 라떼처럼 님이 쓴 글입니다.
> 제목 : 수정 부탁드립니다.
> 시작 시간 전 발생한 진입 조건 신호는 무시하고
장 시작 후 발생한 진입 조건에 의한 진입이 될 수 있게 수정 부탁드립니다.
input : n(30),P1(180), P2(10);
var : mav1(0),t(0),t1(0),tx(0),tl(0);
var1 = ma(c,P2);
var2 = ma(C,P1);
input : 익절1(30),익절1하락(10),손절(30);
input : 시작시간(070100),진입종료(055000);
input : short(12),long(26),sig(9), af(0.02),maxaf(0.1);
var : BH(0),SL(0),para(0),HE(0),LE(0);
var : N1(0),daypl(0),Xcond(false),Tcond(false);
var1 = ma(c,P2);
var2 = ma(C,P1);
if stime == 시작시간 or (stime >시작시간 and stime[1] < 시작시간) Then{
Tcond = true;
N1 = NetProfit;
Xcond = false;
}
if stime == 진입종료 or (stime > 진입종료 and stime[1] < 진입종료) Then{
Tcond = false;
}
if TotalTrades > TotalTrades[1] and
(IsExitName("BB목표수익",1) == true or IsExitName("SS목표수익",1) == true) then
Xcond = true;
daypl = NetProfit-N1;
if Crossup(C,var2) Then
{
t = 1;
t1 = t[1];
tx = Text_New(sdate,stime,H+PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
Condition1 = false;
}
if CrossDown(C,var2) Then
{
t = -1;
t1 = t[1];
tx = Text_New(sdate,stime,L-PriceScale,"■");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
Condition2 = false;
}
if t == 1 and c > var2+PriceScale*n Then
{
t = 2;
tx = Text_New(sdate,stime,H+PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,RED);
}
if t == -1 and c < var2-PriceScale*n Then{
t = -2;
tx = Text_New(sdate,stime,L-PriceScale,"●"+NumToStr(C,2));
Text_SetStyle(tx,2,2);
Text_SetColor(tx,BLUE);
}
if crossup(t,0) and t1 <= -2 Then
{
tx = Text_New(sdate,stime,H+PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,YELLOW);
}
if CrossDown(t,0) and t1 >= 2 Then
{
tx = Text_New(sdate,stime,L-PriceScale*3,"★");
Text_SetStyle(tx,2,2);
Text_SetColor(tx,YELLOW);
}
if Tcond == True then{
if Condition1 == false and t > 0 and t1 <= -2 and var1 > var2 and Xcond == false Then{
Condition1 = true;
buy("BB");
}
if Condition2 == false and t < 0 and t1 >= 2 and var1 < var2 and Xcond == false Then{
Condition2 = true;
sell("SS");
}
}
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*손절);
ExitLong("BB목표수익",atlimit,EntryPrice+((PriceScale*20-daypl)/CurrentContracts));
}
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*손절);
ExitShort("SS목표수익",atlimit,EntryPrice-((PriceScale*20-daypl)/CurrentContracts));
}