예스스탁
예스스탁 답변
2026-07-28 13:34:54
안녕하세요
예스스탁입니다.
옵션객체 Option1, 계좌객체는 Account1입니다.
1
var stime = 140000, etime = 151800;
var BP = 0.02;
var XP1 = 4.90;
var XP2 = 5.90;
var XP3 = 6.90;
var XP4 = 7.90;
var HHMMSS,HHMMSS1;
var HV, HVcode;
var B,X1,X2,X3,X4;
function Main_OnStart()
{
var d = new Date();
HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds();
Main.MessageList(HHMMSS,"|Spot Start");
B = false;
X1 = false;
X2 = false;
X3 = false;
X4 = false;
if (HHMMSS < stime)
{
Main.MessageList(HHMMSS,"|타이머셋팅");
Main.SetTimer(1, 1000);
}
else
{
Main.MessageList(HHMMSS,"|지정시간 이후");
}
}
function Main_OnTimer(nEventID)
{
var d = new Date();
HHMMSS1 = HHMMSS;
HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds();
if (nEventID == 1 && HHMMSS >= stime)
{
if (HHMMSS1 < stime)
{
HV = 0;
HVcode = "";
for(var i = -Option1.lowersATM; i <= Option1.uppersATM; i++)
{
if (HV == 0 || (HV > 0 && Option1.GetVolume(1, -i) > HV))
{
HV = Option1.GetVolume(1, -i);
HVcode = Option1.GetATMPutRecent(-i)
}
}
Main.MessageList(HV,HVcode)
}
if (HHMMSS < etime)
{
if (B == false && HV > 0 && Option1.GetCurrent(HVcode) == BP)
{
Account1.OrderBuy(HVcode, 4, Option1.GetAsk(HVcode, 1), 0);
B = true;
}
if (B == true)
{
if (X1 == false && Option1.GetCurrent(HVcode, 1) >= XP1)
{
X1 = true;
Account1.SetBalance(HVcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(HVcode, 1, Option1.GetBid(HVcode, 1), 0)
}
}
if (X2 == false && Option1.GetCurrent(HVcode, 1) >= XP2)
{
X2 = true;
Account1.SetBalance(HVcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(HVcode, 1, Option1.GetBid(HVcode, 1), 0)
}
}
if (X3 == false && Option1.GetCurrent(HVcode, 1) >= XP3)
{
X3 = true;
Account1.SetBalance(HVcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(HVcode, 1, Option1.GetBid(HVcode, 1), 0)
}
}
if (X4 == false && Option1.GetCurrent(HVcode, 1) >= XP4)
{
X4 = true;
Account1.SetBalance(HVcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(HVcode, 1, Option1.GetBid(HVcode, 1), 0)
}
}
}
}
if (HHMMSS >= etime)
{
Main.KillTimer(1);
Account1.SetBalance(HVcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(HVcode, Account1.Balance.count, Option1.GetBid(HVcode, 1), 0)
}
}
}
}
2
var stime = 140000, etime = 151800;
var BP = 0.02;
var XP1 = 0.90;
var XP2 = 1.90;
var XP3 = 2.90;
var XP4 = 3.90;
var HHMMSS,HHMMSS1;
var LC, LCcode;
var B,X1,X2,X3,X4;
function Main_OnStart()
{
var d = new Date();
HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds();
Main.MessageList(HHMMSS,"|Spot Start");
B = false;
X1 = false;
X2 = false;
X3 = false;
X4 = false;
if (HHMMSS < stime)
{
Main.MessageList(HHMMSS,"|타이머셋팅");
Main.SetTimer(1, 1000);
}
else
{
Main.MessageList(HHMMSS,"|지정시간 이후");
}
}
function Main_OnTimer(nEventID)
{
var d = new Date();
HHMMSS1 = HHMMSS;
HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds();
if (nEventID == 1 && HHMMSS >= stime)
{
if (HHMMSS1 < stime)
{
LC = 0;
LCcode = "";
for(var i = -Option1.lowersATM; i <= Option1.uppersATM; i++)
{
if (LC == 0 || (LC > 0 && Option1.GetCurrent(1, -i) < LC))
{
LC = Option1.GetCurrent(1, -i);
LCcode = Option1.GetATMPutRecent(-i)
}
}
Main.MessageList(LC,LCcode)
}
if (HHMMSS < etime)
{
if (B == false && LC > 0 && Option1.GetCurrent(LCcode) == BP)
{
Account1.OrderBuy(LCcode, 4, Option1.GetAsk(LCcode, 1), 0);
B = true;
}
if (B == true)
{
if (X1 == false && Option1.GetCurrent(LCcode, 1) >= XP1)
{
X1 = true;
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, 1, Option1.GetBid(LCcode, 1), 0)
}
}
if (X2 == false && Option1.GetCurrent(LCcode, 1) >= XP2)
{
X2 = true;
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, 1, Option1.GetBid(LCcode, 1), 0)
}
}
if (X3 == false && Option1.GetCurrent(LCcode, 1) >= XP3)
{
X3 = true;
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, 1, Option1.GetBid(LCcode, 1), 0)
}
}
if (X4 == false && Option1.GetCurrent(LCcode, 1) >= XP4)
{
X4 = true;
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, 1, Option1.GetBid(LCcode, 1), 0)
}
}
}
}
if (HHMMSS >= etime)
{
Main.KillTimer(1);
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, Account1.Balance.count, Option1.GetBid(LCcode, 1), 0)
}
}
}
}
즐거운 하루되세요
예스스탁
예스스탁 답변
2026-07-30 14:40:59
안녕하세요
예스스탁입니다.
가장 낮은 행사가의 풋종목으로 수정해 드립니다.
var stime = 140000, etime = 151800;
var BP = 0.02;
var XP1 = 0.90;
var XP2 = 1.90;
var XP3 = 2.90;
var XP4 = 3.90;
var HHMMSS,HHMMSS1;
var LC, LCcode;
var B,X1,X2,X3,X4;
function Main_OnStart()
{
var d = new Date();
HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds();
Main.MessageList(HHMMSS,"|Spot Start");
B = false;
X1 = false;
X2 = false;
X3 = false;
X4 = false;
if (HHMMSS < stime)
{
Main.MessageList(HHMMSS,"|타이머셋팅");
Main.SetTimer(1, 1000);
}
else
{
Main.MessageList(HHMMSS,"|지정시간 이후");
}
}
function Main_OnTimer(nEventID)
{
var d = new Date();
HHMMSS1 = HHMMSS;
HHMMSS = d.getHours()*10000+d.getMinutes()*100+d.getSeconds();
if (nEventID == 1 && HHMMSS >= stime)
{
if (HHMMSS1 < stime)
{
LCcode = Option1.GetATMPutRecent(Option1.lowersATM)
Main.MessageList(LC,LCcode)
}
if (HHMMSS < etime)
{
if (B == false && LC > 0 && Option1.GetCurrent(LCcode) == BP)
{
Account1.OrderBuy(LCcode, 4, Option1.GetAsk(LCcode, 1), 0);
B = true;
}
if (B == true)
{
if (X1 == false && Option1.GetCurrent(LCcode, 1) >= XP1)
{
X1 = true;
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, 1, Option1.GetBid(LCcode, 1), 0)
}
}
if (X2 == false && Option1.GetCurrent(LCcode, 1) >= XP2)
{
X2 = true;
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, 1, Option1.GetBid(LCcode, 1), 0)
}
}
if (X3 == false && Option1.GetCurrent(LCcode, 1) >= XP3)
{
X3 = true;
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, 1, Option1.GetBid(LCcode, 1), 0)
}
}
if (X4 == false && Option1.GetCurrent(LCcode, 1) >= XP4)
{
X4 = true;
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, 1, Option1.GetBid(LCcode, 1), 0)
}
}
}
}
if (HHMMSS >= etime)
{
Main.KillTimer(1);
Account1.SetBalance(LCcode, 0);
if (Account1.Balance.count > 0 && Account1.Balance.position == 2 )
{
Account1.OrderSell(LCcode, Account1.Balance.count, Option1.GetBid(LCcode, 1), 0)
}
}
}
}
즐거운 하루되세요