예스스탁
예스스탁 답변
2023-02-24 09:05:15
안녕하세요
예스스탁입니다.
1
input : n1(10),n2(15),n3(20),최소수익(20),수익감소(10);
if stime >= 91500 Then
{
진입식
}
if MarketPosition == 1 Then
{
if IsEntryName("b1") == true Then
{
ExitLong("bp1",AtLimit,EntryPrice+PriceScale*n1);
ExitLong("bl1",AtStop,EntryPrice-PriceScale*n1);
}
if IsEntryName("b2") == true Then
{
ExitLong("bp2",AtLimit,EntryPrice+PriceScale*n2);
ExitLong("bl2",AtStop,EntryPrice-PriceScale*n2);
}
if IsEntryName("b3") == true Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*최소수익 Then
ExitLong("btr3",AtStop,highest(H,BarsSinceEntry)-PriceScale*수익감소);
ExitLong("bl3",AtStop,EntryPrice-PriceScale*n3);
}
}
if MarketPosition == -1 Then
{
if IsEntryName("s1") == true Then
{
ExitShort("sp1",AtLimit,EntryPrice-PriceScale*n1);
ExitShort("sl1",AtStop,EntryPrice+PriceScale*n1);
}
if IsEntryName("s2") == true Then
{
ExitShort("sp2",AtLimit,EntryPrice-PriceScale*n2);
ExitShort("sl2",AtStop,EntryPrice+PriceScale*n2);
}
if IsEntryName("s3") == true Then
{
if lowest(L,BarsSinceEntry) >= EntryPrice-PriceScale*최소수익 Then
ExitShort("str3",AtStop,Lowest(L,BarsSinceEntry)+PriceScale*수익감소);
ExitShort("sl3",AtStop,EntryPrice+PriceScale*n3);
}
}
SetStopEndofday(145000);
2
input : n1(10),n2(15),n3(20),최소수익(20),수익감소(10);
var : be1(0),be2(0),be3(0),se1(0),se2(0),se3(0);
var : hh(0),ll(0);
/*if stime >= 91500 Then
{
진입식
}
*/
if MarketPosition == 1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
if IsEntryName("b1") == true Then
be1 = LatestEntryPrice(0);
if IsEntryName("b2") == true Then
be2 = LatestEntryPrice(0);
if IsEntryName("b3") == true Then
be2 = LatestEntryPrice(0);
hh = h;
}
if h > hh Then
hh = h;
if be1 > 0 Then
{
ExitLong("bp1",AtLimit,be1+PriceScale*n1);
ExitLong("bl1",AtStop,be1-PriceScale*n1);
}
if be2 > 0 Then
{
ExitLong("bp2",AtLimit,be2+PriceScale*n2);
ExitLong("bl2",AtStop,be2-PriceScale*n2);
}
if be3 > 0 Then
{
if hh >= be3+PriceScale*최소수익 Then
ExitLong("btr3",AtStop,hh-PriceScale*수익감소);
ExitLong("bl3",AtStop,be3-PriceScale*n3);
}
}
Else
{
be1 = 0;
be2 = 0;
be3 = 0;
}
if MarketPosition == -1 Then
{
if CurrentContracts > CurrentContracts[1] Then
{
if IsEntryName("s1") == true Then
se1 = LatestEntryPrice(0);
if IsEntryName("s2") == true Then
se2 = LatestEntryPrice(0);
if IsEntryName("s3") == true Then
se2 = LatestEntryPrice(0);
ll = l;
}
if l < ll Then
ll = l;
if se1 > 0 Then
{
ExitShort("sp1",AtLimit,se1-PriceScale*n1);
ExitShort("sl1",AtStop,se1+PriceScale*n1);
}
if se2 > 0 Then
{
ExitShort("sp2",AtLimit,se2-PriceScale*n2);
ExitShort("sl2",AtStop,se2+PriceScale*n2);
}
if se3 > 0 Then
{
if ll <= se3-PriceScale*최소수익 Then
ExitShort("str3",AtStop,ll+PriceScale*수익감소);
ExitShort("sl3",AtStop,se3+PriceScale*n3);
}
}
Else
{
se1 = 0;
se2 = 0;
se3 = 0;
}
SetStopEndofday(145000);
즐거운 하루되세요
> 에구머니 님이 쓴 글입니다.
> 제목 : 수식 문의
> 안녕하세요?
모든 진입은 9시 15분 이후에만 가능합니다.
매수조건1이나 매도조건1로, 진입 이름이 b1인 매수나 진입 이름이 s1인 매도로 진입하면 청산은 n1포인트 익절 또는 손절.
매수조건2나 매도조건2로, 진입 이름이 b2인 매수나 진입 이름이 s2인 매도로 진입하면 청산은 n2포인트 익절 또는 손절.
매수조건3이나 매도조건2으로, 진입 이름이 b3인 매수나 진입 이름이 s3인 매도로 진입하면 청산은 트레일링 스탑으로 익절 또는 n3 포인트 손절
그리고, 14:50분에 모든 포지션 청산.
요런 수식 부탁드립니다.
버전 1은 복수 진입 허용 안하는 것과
버전 2는 복수 진입 허용하는 것으로 부탁드립니다.
(혹시, 매수포지션 있을 때, 매도 진입 안되면, 스위칭 개념 입니다.
즉, 기존의 b1 매수포지션에 b2 매수신호가 뜨면 1개 더 매수...
기존의 b1 매수포지션이 있는데 s2 매도신호가 뜨면 기존의 매수 포지션들은 모두 청산하고 새로 매도 진입하는 식으로요.)
물론, 복수 진입 허용입니다.
감사합니다.