EAの設計:マーケットとアカウント情報確認

 

取引の前に、特に自分の口座はどんな状況なのかを確認したほうが良いです。

また、場合によって、途中で金利の差が変動になったり、レバレッジの倍数が変わったりすることで、売買戦略を調整することも考えられます。

 

次にMarketInfoAccount関数を使って、ご利用の口座情報などを確認できます。

//+------------------------------------------------------------------+
// Show market information.
//+------------------------------------------------------------------+
void ShowMarketInfo()
{
    Print("Symbol:",                symbol);
    Print("Ask:",                   MarketInfo(symbol, MODE_ASK));                  // 110.431
    Print("Bid:",                   MarketInfo(symbol, MODE_BID));                  // 110.410
    Print("Point:",                 MarketInfo(symbol, MODE_POINT));                // 0.001
    Print("Digits:",                MarketInfo(symbol, MODE_DIGITS));               // 3
    Print("Spread:",                MarketInfo(symbol, MODE_SPREAD));               // 21 NOTE: NOT 0.021 !!!
    Print("Stop level:",            MarketInfo(symbol, MODE_STOPLEVEL));            // 40
    Print("Lot size:",              MarketInfo(symbol, MODE_LOTSIZE));              // 10_0000(USD)
    Print("Tick value:",            MarketInfo(symbol, MODE_TICKVALUE));            // 100
    Print("Tick size:",             MarketInfo(symbol, MODE_TICKSIZE));             // 0.001
    Print("Swap long:",             MarketInfo(symbol, MODE_SWAPLONG));             // -0.83
    Print("Swap short:",            MarketInfo(symbol, MODE_SWAPSHORT));            // -5.15
    Print("Min lot:",               MarketInfo(symbol, MODE_MINLOT));               // 0.01
    Print("Lot step:",              MarketInfo(symbol, MODE_LOTSTEP));              // 0.1  *** It is different between different account ***
    Print("Max lot:",               MarketInfo(symbol, MODE_MAXLOT));               // 1000 *** It is different between different account ***
    Print("Margin init:",           MarketInfo(symbol, MODE_MARGININIT));           // 0
    Print("Margin maintenance:",    MarketInfo(symbol, MODE_MARGINMAINTENANCE));    // 0
    Print("Margin hedged:",         MarketInfo(symbol, MODE_MARGINHEDGED));         // 0
    Print("Margin required:",       MarketInfo(symbol, MODE_MARGINREQUIRED));       // 333.33(USD) <- LOTSIZE / LEVERAGE;   36807(JPY) <- ASK * LOTSIZE / LEVERAGE
    Print("Freeze level:",          MarketInfo(symbol, MODE_FREEZELEVEL));          // 0
}

//+------------------------------------------------------------------+
// Show starting acount information.
//+------------------------------------------------------------------+
void ShowAccountInfo()
{
    Print("Balance:",               DoubleToStr(AccountBalance(), 0));
    Print("Credit:",                DoubleToStr(AccountCredit(),  0));
    Print("Company:",               AccountCompany());
    Print("Currency:",              AccountCurrency());
    Print("Equity:",                DoubleToStr(AccountEquity(),   0));
    Print("Free margin:",           AccountFreeMargin());
    Print("Free margin check:",     AccountFreeMarginCheck(symbol, OP_BUY, MarketInfo(symbol, MODE_MINLOT))); // 499631.93 <- Free Margin - ASK * LOTSIZE * orderLotSize / LEVERAGE
    Print("Free margin mode:",      AccountFreeMarginMode());
    Print("Ask:",                   DoubleToStr(Ask, Digits));
    Print("Leverage:",              AccountLeverage());
    Print("Margin:",                AccountMargin());
    Print("Name:",                  AccountName());
    Print("Number:",                AccountNumber());
    Print("Profit:",                AccountProfit());
    Print("Server:",                AccountServer());
    Print("Stop out level:",        AccountStopoutLevel());
    Print("Stop out mode:",         AccountStopoutMode());
}

 

そして出力の一例は次です。太字部分は注意すべきところです。

0 19:21:52.131 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Symbol:USDJPY
0 19:21:52.131 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Ask:128.647
0 19:21:52.131 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Bid:128.625
0 19:21:52.131 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Point:0.001
0 19:21:52.131 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Digits:3.0
0 19:21:52.131 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Spread:22.0
0 19:21:52.131 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Stop level:20.0
0 19:21:52.131 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Lot size:100000.0 ← 1ロットの通貨数量(1ロット10万ドル)
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Tick value:100.0
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Tick size:0.001
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Swap long:0.21 ← 買いポジションのスワップポイント、マイナスになることある
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Swap short:0.28 ← 売りポジションのスワップポイント、マイナスになることある
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Min lot:0.01 ← 一回の注文で、最小のサイズ
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Lot step:0.01 ← 注文出せる刻み
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Max lot:50.0 ← 一回の注文で、最大のサイズ
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Margin init:100000.0
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Margin maintenance:0.0
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Margin hedged:0.0
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Margin required:2572.72
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Freeze level:0.0
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Balance:100000
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Credit:0
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Company:GemTrade Co., Ltd
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Currency:JPY
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Equity:100000
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Free margin:100000.0
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Free margin check:99974.27280000001
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Free margin mode:1
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Ask:128.647
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Leverage:5000 ← レバレッジ倍数
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Margin:0.0
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Name:LIN HUA
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Number:520016716
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Profit:0.0
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Server:GemTrade-Live6
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Stop out level:20 ← 強制ロスカットのパーセンテージ
0 19:21:52.132 2022.06.01 00:00:00  DreamCreator USDJPY,M1: Stop out mode:0

 

FX

コメント

error: Content is protected !!
タイトルとURLをコピーしました