MT4在特定时间停止开仓
input int TakeProfit = 5;
input double Lots = 0.01;
input int MagicNumber = 12345;
input bool Weekend_Stop = true;
input int Stop_Day_Of_Week1 = 1;
input int Stop_Day_Of_Week2 = 5;
input int Stop_Hours = 14;

int OnInit() {

    return (INIT_SUCCEEDED);
}

void OnDeinit(const int reason) {
}

void OnTick() {

    double kakoMA50, kakoMA100;
    double genMA50, genMA100;

    kakoMA50 = iMA(NULL, 0, 50, 0, MODE_SMA, PRICE_CLOSE, 1);
    kakoMA100 = iMA(NULL, 0, 100, 0, MODE_SMA, PRICE_CLOSE, 1);
    genMA50 = iMA(NULL, 0, 50, 0, MODE_SMA, PRICE_CLOSE, 0);
    genMA100 = iMA(NULL, 0, 100, 0, MODE_SMA, PRICE_CLOSE, 0);

    int NowTime = TimeHour(TimeCurrent());
    bool OderStop = False;
    if (Weekend_Stop == true && NowTime >= Stop_Hours) {
        if (DayOfWeek() == Stop_Day_Of_Week1 || DayOfWeek() == Stop_Day_Of_Week2) {
            OderStop = true;
        }
    }
    if (kakoMA50 <= kakoMA100 && genMA50 > genMA100 && OderStop == False) {
        OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, Ask + TakeProfit * Point * 10, "Order Long", MagicNumber, 0, Red);
    }

    if (kakoMA50 >= kakoMA100 && genMA50 < genMA100 && OderStop == False) {
        OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, 0, Bid - TakeProfit * Point * 10, "Order Short", MagicNumber, 0, Blue);
    }
}
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇