예스스탁
예스스탁 답변
2024-01-23 13:42:00
안녕하세요
예스스탁입니다.
1
input : 이평1(30),이평2(60),이평3(120),이평4(240),이평5(480);
input : 윌리엄스R기간값(14);
input : 손절틱수(200),트레일링스탑틱수(5),목표틱수(200);
var : mav1(0),mav2(0),mav3(0),mav4(0),mav5(0);
MAV1=MA(c,이평1);
MAV2=MA(c,이평2);
MAV3=MA(c,이평3);
MAV4=MA(c,이평4);
MAV5=MA(c,이평5);
if MarketPosition <= 0 and c > mav4 and CrossUp(c, mav5) Then
Buy("b");
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*목표틱수 Then
{
if CrossDown(C,mav4) Then
ExitLong("bx");
ExitLong("btr",AtStop,EntryPrice+PriceScale*트레일링스탑틱수);
}
}
if MarketPosition >= 0 and c < mav4 and CrossDown(c, mav5) Then
Sell("s");
if MarketPosition == -1 Then
{
if Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*목표틱수 Then
{
if CrossUp(C,mav4) Then
ExitShort("sx");
ExitShort("str",AtStop,EntryPrice-PriceScale*트레일링스탑틱수);
}
}
SetStopLoss(PriceScale*손절틱수,PointStop);
2
Input:Len(20);
input : 손절틱수(200),트레일링스탑틱수(5),목표틱수(200);
Var:Mp(0);
var:bValue0(0),bValue1(0);
var:sValue0(0),sValue1(0);
Mp = MarketPosition;
bValue0 = Highest(High,Len);
sValue0 = lowest(Low,Len);
if MarketPosition <= 0 Then
Buy("매수", atstop, bValue0);
if MarketPosition >= 0 Then
sell("매도", atstop, sValue0);
If Mp==1 and Mp[1]==Mp then
bValue1=bvalue0-Lowest(low,Len)[1];
If Mp==-1 and Mp[1]==Mp then
sValue1=highest(high,Len)[1]-svalue0;
If PositionProfit>0 then
ExitLong("매수청산", atstop, bValue0-bValue1);
If PositionProfit<0 then
ExitShort("매도청산", atstop, sValue0+sValue1);
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*목표틱수 Then
{
ExitLong("btr",AtStop,EntryPrice+PriceScale*트레일링스탑틱수);
}
}
if MarketPosition == -1 Then
{
if lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*목표틱수 Then
{
ExitShort("str",AtStop,EntryPrice-PriceScale*트레일링스탑틱수);
}
}
SetStopLoss(PriceScale*손절틱수,PointStop);
즐거운 하루되세요
> 행복곰 님이 쓴 글입니다.
> 제목 : 수식 추가 부탁드립니다
> 수고많으십니다. 도움주셔서 감사드려요.
다름이 아니오라, (수식1) (수식2)
현재 매수만 잡히고 있는데, 선물거래도 가능하도록, 매수/ 매도 양방향 다 되도록
매도 수식 추가// 부탁드립니다.
(트레일링, 목표틱수, 손절틱수도 동일하게 매도도 가능하게 부탁)
1번 수식
input : 이평1(30),이평2(60),이평3(120),이평4(240),이평5(480);
input : 윌리엄스R기간값(14);
input : 손절틱수(200),트레일링스탑틱수(5),목표틱수(200);
var : mav1(0),mav2(0),mav3(0),mav4(0),mav5(0);
MAV1=MA(c,이평1);
MAV2=MA(c,이평2);
MAV3=MA(c,이평3);
MAV4=MA(c,이평4);
MAV5=MA(c,이평5);
if MarketPosition == 0 and c > mav4 and CrossUp(c, mav5) Then
Buy("b");
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*목표틱수 Then
{
if CrossDown(C,mav4) Then
ExitLong("bx");
ExitLong("btr",AtStop,EntryPrice+PriceScale*트레일링스탑틱수);
}
}
SetStopLoss(PriceScale*손절틱수,PointStop);
2번 수식
Input:Len(20);
input : 손절틱수(200),트레일링스탑틱수(5),목표틱수(200);
Var:Mp(0),Value0(0),Value1(0);
Mp = MarketPosition;
Value0 = Highest(High,Len);
Buy("매수", atstop, Value0);
If Mp==1 and Mp[1]==0 then
Value1=value0-Lowest(low,Len)[1];
If PositionProfit>0 then
ExitLong("매수청산", atstop, Value0-Value1);
if MarketPosition == 1 Then
{
if highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*목표틱수 Then
{
ExitLong("btr",AtStop,EntryPrice+PriceScale*트레일링스탑틱수);
}
}
SetStopLoss(PriceScale*손절틱수,PointStop);