커뮤니티

마틴적용 수정 부탁합니다

프로필 이미지
호시우보
2025-11-03 16:08:10
66
글번호 227601
답변완료

Input : P(100), MartinMult(2), BaseQty(1); Vars : T(0), Bcond(False), Scond(False), var1(0), var2(0), value3(0), MartinCount(0), LossTrigger(0), PriceStep(PriceScale*5); value3 = MA(C, P); var1 = MA(C, 36); var2 = (Highest(High, 52)[25] + Lowest(Low, 52)[25]) / 2; //------------------------------ // 추세 전환시 초기화 //------------------------------ if CrossUp(C, var1) then begin T = 1; Bcond = False; MartinCount = 0; end; if CrossDown(C, var1) then begin T = -1; Scond = False; MartinCount = 0; end; //------------------------------ // 매수 조건 //------------------------------ if stime >= 093000 and stime < 150000 and T = 1 then begin if L >= var2 + PriceScale*2 then begin if TotalTrades = 0 or (MarketPosition = -1 and BarsSinceEntry >= 130 and BarsSinceExit(1) >= 43) or (TotalTrades >= 1 and MarketPosition = 0 and BarsSinceExit(1) >= 130) then Bcond = True; end; if Bcond and C > value3 then begin Buy("B1") BaseQty contracts at var1 + 0.2 limit; MartinCount = 1; LossTrigger = EntryPrice - PriceStep; // 마틴 기준선 설정 end; // 마틴 진입 if MarketPosition = 1 and MartinCount < 3 then begin if C <= LossTrigger then begin Buy("B-Martin") BaseQty * MartinMult contracts at Market; MartinCount = MartinCount + 1; LossTrigger = EntryPrice - PriceStep; // 다음 회차 기준선 업데이트 end; end; end; //------------------------------ // 매도 조건 //------------------------------ if stime >= 093000 and stime < 150000 and T = -1 then begin if H <= var2 - PriceScale*2 then begin if TotalTrades = 0 or (MarketPosition = 1 and BarsSinceEntry >= 130 and BarsSinceExit(1) >= 43) or (TotalTrades >= 1 and MarketPosition = 0 and BarsSinceExit(1) >= 130) then Scond = True; end; if Scond and C < value3 then begin SellShort("S1") BaseQty contracts at var1 - 0.2 limit; MartinCount = 1; LossTrigger = EntryPrice + PriceStep; end; // 마틴 진입 if MarketPosition = -1 and MartinCount < 3 then begin if C >= LossTrigger then begin SellShort("S-Martin") BaseQty * MartinMult contracts at Market; MartinCount = MartinCount + 1; LossTrigger = EntryPrice + PriceStep; end; end; end; //------------------------------ // 청산 시 초기화 //------------------------------ if MarketPosition = 0 then MartinCount = 0;

시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-11-04 09:24:21

안녕하세요 예스스탁입니다. Input : P(100), MartinMult(2), BaseQty(1); Vars : T(0), Bcond(False), Scond(False), var1(0), var2(0), value3(0), MartinCount(0), LossTrigger(0), PriceStep(PriceScale*5); value3 = MA(C, P); var1 = MA(C, 36); var2 = (Highest(High, 52)[25] + Lowest(Low, 52)[25]) / 2; //------------------------------ // 추세 전환시 초기화 //------------------------------ if CrossUp(C, var1) then begin T = 1; Bcond = False; MartinCount = 0; end; if CrossDown(C, var1) then begin T = -1; Scond = False; MartinCount = 0; end; //------------------------------ // 매수 조건 //------------------------------ if stime >= 093000 and stime < 150000 and T == 1 then begin if L >= var2 + PriceScale*2 then begin if TotalTrades == 0 or (MarketPosition == -1 and BarsSinceEntry >= 130 and BarsSinceExit(1) >= 43) or (TotalTrades >= 1 and MarketPosition == 0 and BarsSinceExit(1) >= 130) then Bcond = True; end; if Bcond and C > value3 then begin Buy("B1",AtLimit,var1 + 0.2,BaseQty); MartinCount = 1; LossTrigger = EntryPrice - PriceStep; // 마틴 기준선 설정 end; // 마틴 진입 if MarketPosition == 1 and MartinCount < 3 then begin if C <= LossTrigger then begin Buy("B-Martin",AtMarket,Def, BaseQty * MartinMult); MartinCount = MartinCount + 1; LossTrigger = EntryPrice - PriceStep; // 다음 회차 기준선 업데이트 end; end; end; //------------------------------ // 매도 조건 //------------------------------ if stime >= 093000 and stime < 150000 and T == -1 then begin if H <= var2 - PriceScale*2 then begin if TotalTrades == 0 or (MarketPosition == 1 and BarsSinceEntry >= 130 and BarsSinceExit(1) >= 43) or (TotalTrades >= 1 and MarketPosition == 0 and BarsSinceExit(1) >= 130) then Scond = True; end; if Scond and C < value3 then begin Sell("S1",AtLimit,var1 - 0.2, BaseQty); MartinCount = 1; LossTrigger = EntryPrice + PriceStep; end; // 마틴 진입 if MarketPosition == -1 and MartinCount < 3 then begin if C >= LossTrigger then begin Sell("S-Martin",AtMarket,Def,BaseQty * MartinMult); MartinCount = MartinCount + 1; LossTrigger = EntryPrice + PriceStep; end; end; end; //------------------------------ // 청산 시 초기화 //------------------------------ if MarketPosition == 0 then MartinCount = 0; 즐거운 하루되세요