设为首页收藏本站

 找回密码
 注册
查看: 2752|回复: 3

转成文华语言模型 [复制链接]

Rank: 1

精华
0
UID
248239
积分
3
帖子
2
主题
1
阅读权限
10
注册时间
2017-3-7
最后登录
2017-3-10
发表于 2017-3-7 08:15:07 |显示全部楼层
PARAMS
    Numeric Direction(0);
    Numeric SlipJump(1);
    Numeric LotL(0);
    Numeric LotS(0);
    Numeric EntTimeA(93000);
    Numeric EntTimeB(143000);
    Numeric CCILength(15);
    Numeric CMOLength(37);
    Numeric ParAfStep(0.03);
    Numeric ParAfLimit(0.19);
    Numeric PCLenA1(76);
    Numeric PCLenA2(87);
    Numeric PCNA(44);
    Numeric PCLenC1(76);
    Numeric PCLenC2(87);
    Numeric PCNC(44);
    Numeric ExAbsStopPcL(0.57);
    Numeric ExAbsTargPcL(2.99);
    Numeric ExDnRanLenL1(4);
    Numeric ExDnRanLenL2(35);
    Numeric ExDnRanLenL3(77);
    Numeric ExDnRanLenL4(93);
    Numeric ExAbsStopPcS(0.57);
    Numeric ExAbsTargPcS(2.99);
    Numeric ExUpRanLenS1(4);
    Numeric ExUpRanLenS2(35);
    Numeric ExUpRanLenS3(77);
    Numeric ExUpRanLenS4(93);

VARS
    Numeric Slip;
    Bool Cond_Time;
    Numeric EntPrice;
    Numeric ExtPrice;
    NumericSeries CCITmp;
    Numeric CCIMean(0);
    Numeric CCIAvgDev(0);
    Numeric CCICounter(0);
    NumericSeries CCI(0);
    NumericSeries CMO;
    NumericSeries CMOCloseUp;
    NumericSeries CMOCloseDown;
    Numeric CMOSumCloseUp;
    Numeric CMOSumCloseDown;
    Numeric ParClose;
    Numeric ParOpen;
    Numeric ParPosition;
    Numeric ParTransition;
    BoolSeries ConditionA;
    BoolSeries ConditionB;
    BoolSeries ConditionC;
    BoolSeries ConditionD;
    BoolSeries EntMarketCondL;
    BoolSeries EntMarketCondS;
    Numeric ExAbsStopL;
    Numeric ExAbsTargetL;
    NumericSeries ExDownRangeL;
    Numeric ExAbsStopS;
    Numeric ExAbsTargetS;
    NumericSeries ExUpRangeS;

BEGIN
    Cond_Time = Time >= EntTimeA/1000000 && Time <= EntTimeB/1000000;

    Slip = SlipJump * MinMove * PriceScale;

    /* Calculate indicator CCI ----------------------------------------- */
    CCITmp = High + Low + Close;
    CCIMean = AverageFC(CCITmp, CCILength);
    CCIAvgDev = 0;
    For CCICounter = 0 to CCILength - 1
        CCIAvgDev = CCIAvgDev + Abs(CCITmp[CCICounter] - CCIMean);
    CCIAvgDev = CCIAvgDev / CCILength;
    If ( CCIAvgDev == 0 )
        CCI = 0;
    Else
        CCI = (CCITmp - CCIMean) / (0.015 * CCIAvgDev);

    /* Calculate indicator CMO ----------------------------------------- */
    If ( Close > Close[1] ) {
        CMOCloseUp = Close - Close[1];
        CMOCloseDown = 0;
    } Else If ( Close < Close[1] ) {
        CMOCloseUp = 0;
        CMOCloseDown = Close[1] - Close;
    } Else {
        CMOCloseUp = 0;
        CMOCloseDown = 0;
    }
    CMOSumCloseUp = SummationFC(CMOCloseUp, CMOLength);
    CMOSumCloseDown = SummationFC(CMOCloseDown, CMOLength);
    If ( CMOSumCloseUp + CMOSumCloseDown <> 0 )
        CMO = (CMOSumCloseUp - CMOSumCloseDown) / (CMOSumCloseUp + CMOSumCloseDown) * 100;

    /* Calculate indicator ParabolicSAR -------------------------------- */
    ParabolicSAR(ParAfStep, ParAfLimit, ParClose, ParOpen, ParPosition, ParTransition);

    /* Calculate conditions -------------------------------------------- */
    ConditionA = CrossUnder(MidPoint(CMO, PCLenA2), XAverage(CMO[PCNA], PCLenA1));
    ConditionB = Max(CCI, CCI) < 0;
    ConditionC = CrossOver(MidPoint(CMO, PCLenC2), XAverage(CMO[PCNC], PCLenC1));
    ConditionD = Min(CCI, CCI) > 0;

    /* Long entry module ----------------------------------------------- */
    EntMarketCondL = CrossUnder(ParTransition, 0);
    If (Direction >= 0 && MarketPosition == 0 && Cond_Time) {   
        If (EntMarketCondL[1]) {
            EntPrice = IIF(AccountDataExist, 0, Open);
            Buy(LotL, EntPrice);
        }
    }

    /* Short entry module ---------------------------------------------- */
    EntMarketCondS = CrossOver(ParTransition, 0);
    If (Direction <= 0 && MarketPosition == 0 && Cond_Time) {   
        If (EntMarketCondS[1]) {
            EntPrice = IIF(AccountDataExist, 0, Open);
            SellShort(LotS, EntPrice);
        }
    }

    /* Long stop loss exit module -------------------------------------- */
    ExAbsStopL = EntryPrice * (1 - ExAbsStopPcL/100);         
    If (Direction >= 0 && MarketPosition == 1 && BarsSinceLastEntry > 0) {
        If (Open <= ExAbsStopL) {
            ExtPrice = IIF(AccountDataExist, Q_BidPrice-Slip, Open);
            Sell(0, ExtPrice);
        }
    }

    /* Long bands exit module ------------------------------------------ */
    ExDownRangeL = SAverage(Low, ExDnRanLenL4) - MidPoint(Abs((SMA((Close*2+High+Low)/4, ExDnRanLenL3, ExDnRanLenL1) - TrueHigh)), ExDnRanLenL2);
    If (Direction >= 0 && MarketPosition == 1 && BarsSinceLastEntry > 0) {
        If (Open <= ExDownRangeL[1] && (ConditionB[1] && ConditionA[1])) {
            ExtPrice = IIF(AccountDataExist, Q_BidPrice-Slip, Open);
            Sell(0, ExtPrice);
        }
    }

    /* Long stop profit exit module ------------------------------------ */
    ExAbsTargetL = EntryPrice * (1 + ExAbsTargPcL/100);
    If (Direction >= 0 && MarketPosition == 1 && BarsSinceLastEntry > 0) {
        If (Close[1] >= ExAbsTargetL) {
            ExtPrice = IIF(AccountDataExist, Q_BidPrice-Slip, Open);
            Sell(0, ExtPrice);
        }
    }

    /* Short stop loss exit module ------------------------------------- */
    ExAbsStopS = EntryPrice * (1 + ExAbsStopPcS/100);         
    If (Direction <= 0 && MarketPosition == -1 && BarsSinceLastEntry > 0) {
        If (Open >= ExAbsStopS) {
            ExtPrice = IIF(AccountDataExist, Q_AskPrice+Slip, Open);
            BuyToCover(0, ExtPrice);
        }
    }

    /* Short bands exit module ----------------------------------------- */
    ExUpRangeS = SAverage(High, ExUpRanLenS4) + MidPoint(Abs((SMA((Close*2+High+Low)/4, ExUpRanLenS3, ExUpRanLenS1) - TrueLow)), ExUpRanLenS2);
    If (Direction <= 0 && MarketPosition == -1 && BarsSinceLastEntry > 0) {
        If (Open >= ExUpRangeS[1] && (ConditionD[1] && ConditionC[1])) {
            ExtPrice = IIF(AccountDataExist, Q_AskPrice+Slip, Open);
            BuyToCover(0, ExtPrice);
        }
    }

    /* Short stop profit exit module ----------------------------------- */
    ExAbsTargetS = EntryPrice * (1 - ExAbsTargPcS/100);
    If (Direction <= 0 && MarketPosition == -1 && BarsSinceLastEntry > 0) {
        If (Close[1] <= ExAbsTargetS) {
            ExtPrice = IIF(AccountDataExist, Q_AskPrice+Slip, Open);
            BuyToCover(0, ExtPrice);
        }
    }

END

Rank: 1

精华
0
UID
248239
积分
3
帖子
2
主题
1
阅读权限
10
注册时间
2017-3-7
最后登录
2017-3-10
发表于 2017-3-7 08:15:46 |显示全部楼层
多谢了

使用道具 举报

Rank: 1

精华
0
UID
254558
积分
17
帖子
8
主题
3
阅读权限
10
注册时间
2017-7-26
最后登录
2023-2-18
发表于 2017-11-2 18:02:14 来自手机 |显示全部楼层
hcf700818 发表于 2017-3-7 08:15
多谢了

你是有多傻呀,这是TB论坛!谁会给竞争对手做事啊。去文华的论坛找帮助了

使用道具 举报

Rank: 2

精华
0
UID
256081
积分
85
帖子
68
主题
11
阅读权限
30
注册时间
2017-8-28
最后登录
2022-6-2
发表于 2018-3-6 07:21:46 |显示全部楼层
:lol:lol

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

bottom

静态版|手机版|联系我们|交易开拓者 ( 粤ICP备07044698   

GMT+8, 2024-4-16 18:54

Powered by Discuz! X2 LicensedChrome插件扩展

© 2011-2012 交易开拓者 Inc.

回顶部