コーディングのヘルプ - ページ 667

 
青い矢印が現れたら買い、赤い矢印が現れたら売り、矢印の隣のキャンドルが閉じたら取引を終了します。
 
dotmund:
青い矢印が表示されたら買い、赤い矢印が表示されたら売り、矢印の隣のキャンドルが閉じたら取引を終了します。
このポストをチェックしてください:https://www.mql5.com/en/forum/180648/page940
 
mladen:

ローソク足については、それに特化したインジケータを使用するのがベストです(添付のようなもの)。

ピリオドセパレータについては、すでにnmcになっているが、添付のものを使うとよい(CPUの負担が軽くなるはず)。

ありがとうございました。BarsLimitの オプションを追加 しようと思って いるのですがうまく いきません助けていただけませんか? お手数ですが、よろしくお願いします。
ファイル:
 
Entropy:
どうもありがとうございました。BarsLimit」のオプションを追加 しようと思って いるのですがうまく いきません助けていただけませんか? お忙しい中、誠にありがとうございます。

エントロピ

以下は、そのオプションを追加したバージョンです。

ファイル:
 

こんにちはmladenは、私は宣言を解決するために教えることができます。

これは、私は警告を得るものです。

declaration of 'MinLots' hides global declaration at line 93    
declaration of 'MaxLots' hides global declaration at line 94    
declaration of 'Magic' hides global declaration at line 118     
void CalculateMM()
{
   double MinLots=MarketInfo(Symbol(),MODE_MINLOT);
   double MaxLots=MarketInfo(Symbol(),MODE_MAXLOT);
   Lots=AccountFreeMargin()/100000*RiskPercent;
   Lots=MathMin(MaxLots,MathMax(MinLots,Lots));
   if(MinLots<0.1)Lots=NormalizeDouble(Lots,2);
   else
   {
     if(MinLots<1)Lots=NormalizeDouble(Lots,1);
     else Lots=NormalizeDouble(Lots,0);
   }
   if(Lots<MinLots)Lots=MinLots;
   if(Lots>MaxLots)Lots=MaxLots;
   return;



int CloseBuyOrders(int Magic)
{
  int total=OrdersTotal();

  for (int cnt=total-1;cnt>=0;cnt--)
  {
    if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) 
    if(OrderMagicNumber()==Magic&&OrderSymbol()==Symbol())
    {
      if(OrderType()==OP_BUY)
      {
       ClTicket= OrderClose(OrderTicket(),OrderLots(),Bid,3);
      }
    }
  }
  return(0);
}

int CloseBuyOrdersHiddenTP(int Magic)
{
  int total=OrdersTotal();

  for (int cnt=total-1;cnt>=0;cnt--)
  {
    if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) 
    if(OrderMagicNumber()==Magic&&OrderSymbol()==Symbol())
    {
      if(OrderType()==OP_BUY&&Bid>(OrderOpenPrice()+TakeProfit*Point))
      {
        ClTicket=OrderClose(OrderTicket(),OrderLots(),Bid,3);
      }
    }
  }
  return(0);
}

ありがとうございます。

 
stevenpun:

こんにちはmladenは、私は宣言を解決するために教えることができます。

これは、私は警告を得るものです。



ありがとうございます。

まず、この。

void CalculateMM()
{
   double tMinLots=MarketInfo(Symbol(),MODE_MINLOT);
   double tMaxLots=MarketInfo(Symbol(),MODE_MAXLOT);
   Lots=AccountFreeMargin()/100000*RiskPercent;
   Lots=MathMin(tMaxLots,MathMax(tMinLots,Lots));
   if(tMinLots<0.1)Lots=NormalizeDouble(Lots,2);
   else
   {
     if(tMinLots<1)Lots=NormalizeDouble(Lots,1);
     else Lots=NormalizeDouble(Lots,0);
   }
   if(Lots<tMinLots)Lots=tMinLots;
   if(Lots>tMaxLots)Lots=tMaxLots;
   return;

とこれ

int CloseBuyOrders(int tMagic)
{
  int total=OrdersTotal();

  for (int cnt=total-1;cnt>=0;cnt--)
  {
    if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) 
    if(OrderMagicNumber()==tMagic&&OrderSymbol()==Symbol())
    {
      if(OrderType()==OP_BUY)
      {
       ClTicket= OrderClose(OrderTicket(),OrderLots(),Bid,3);
      }
    }
  }
  return(0);
}

int CloseBuyOrdersHiddenTP(int tMagic)
{
  int total=OrdersTotal();

  for (int cnt=total-1;cnt>=0;cnt--)
  {
    if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) 
    if(OrderMagicNumber()==tMagic&&OrderSymbol()==Symbol())
    {
      if(OrderType()==OP_BUY&&Bid>(OrderOpenPrice()+TakeProfit*Point))
      {
        ClTicket=OrderClose(OrderTicket(),OrderLots(),Bid,3);
      }
    }
  }
  return(0);
}
 

こんにちは、Mladen。

このコードで、修正すべき点を教えていただけませんか?

また、上位のタイムフレームになった場合、次のように変更することは可能でしょうか?

===> 1分~30分 ==> 10pips毎

===> 1時間足====> 50pips毎

===> 4時間足、日足================================100pips毎

===> 週足、月足 ===> 1000pips毎

線ではなく、長方形が希望です。

#プロパティ indicator_chart_window

#define ONDA_BEGINS 0

#define ONDA_CONTAINS 1



//+------------------------------------------------------------------+

//| カスタムインジケータ初期化関数

//+------------------------------------------------------------------+

int init()

{

//---- インジケーター


//----

return(0);

}

//+------------------------------------------------------------------+

//| カスタムインジケータ初期化関数

//+------------------------------------------------------------------+

int deinit()

{

//----

for (int ix = 0; ix < nLines; ix++) //横線を 削除する。

{

ObjectDelete("tensLines "+ix);

}


//----

return(0);

}

//+------------------------------------------------------------------+

//| カスタムインジケーターイテレーション関数

//+------------------------------------------------------------------+

int start()

{

int nLines = 40; // 描画する全ラインの数

double lineInterval = 0.0010; // ラインとラインの間の間隔

double normPrice = NormalizeDouble(Close[1],3); // 現在値は "10 "未満を四捨五入しています。


for (int ix = 0; ix < nLines; ix++) // ループスパン回数

{

if(ObjectFind("tensLines "+ix) < 0)

ObjectCreate("tensLines "+ix, OBJ_HLINE, 0, 0, normPrice+((ix-(nLines/2))*lineInterval)); // 現在の価格の上半分、下半分に配置する。


else ObjectSet("tensLines "+ix, OBJPROP_PRICE1, normPrice+((ix-(nLines/2))*lineInterval));

ObjectSet("tensLines "+ix,OBJPROP_COLOR,DarkSlateGray); // 線をきれいに見せる

}

//----

return(0);

}

//+------------------------------------------------------------------+


void ObjectNameDeleteAll(string name, int where=ONDA_BEGINS, int type=EMPTY)

{

for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--)

{

string on = ObjectName(iObj);

int iPos = StringFind(on, name);

if (iPos < 0) continue;

if (iPos > 0 && where == ONDA_BEGINS) continue;

if (type == EMPTY) ObjectDelete(on);

else if (type == ObjectType(on))ObjectDelete(on);

}

}




//---

 
murnathan32:

こんにちは、Mladen。

このコードで、修正すべき点を教えていただけませんか?

また、上位のタイムフレームになった場合、次のように変更することは可能でしょうか?

===> 1分~30分 ==> 10pips毎

===> 1時間足====> 50pips毎

===> 4時間足、日足================================100pips毎

===> 週足、月足 ===> 1000pips毎

線ではなく、長方形が希望です。

#プロパティ indicator_chart_window

#define ONDA_BEGINS 0

#define ONDA_CONTAINS 1



//+------------------------------------------------------------------+

//| カスタムインジケータ初期化関数

//+------------------------------------------------------------------+

int init()

{

//---- インジケーター


//----

return(0);

}

//+------------------------------------------------------------------+

//| カスタムインジケータ初期化関数

//+------------------------------------------------------------------+

int deinit()

{

//----

for (int ix = 0; ix < nLines; ix++) // 横線を削除する。

{

ObjectDelete("tensLines "+ix);

}


//----

return(0);

}

//+------------------------------------------------------------------+

//| カスタムインジケーターイテレーション関数

//+------------------------------------------------------------------+

int start()

{

int nLines = 40; // 描画する全ラインの数

double lineInterval = 0.0010; // ラインとラインの間の間隔

double normPrice = NormalizeDouble(Close[1],3); // 現在値は "10 "未満を四捨五入しています。


for (int ix = 0; ix < nLines; ix++) // ループスパン回数

{

if(ObjectFind("tensLines "+ix) < 0)

ObjectCreate("tensLines "+ix, OBJ_HLINE, 0, 0, normPrice+((ix-(nLines/2))*lineInterval)); // 現在の価格の上半分、下半分に配置する。


else ObjectSet("tensLines "+ix, OBJPROP_PRICE1, normPrice+((ix-(nLines/2))*lineInterval));

ObjectSet("tensLines "+ix,OBJPROP_COLOR,DarkSlateGray); // 線をきれいに見せる

}

//----

return(0);

}

//+------------------------------------------------------------------+


void ObjectNameDeleteAll(string name, int where=ONDA_BEGINS, int type=EMPTY)

{

for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--)

{

string on = ObjectName(iObj);

int iPos = StringFind(on, name);

if (iPos < 0) continue;

if (iPos > 0 && where == ONDA_BEGINS) continue;

if (type == EMPTY) ObjectDelete(on);

else if (type == ObjectType(on))ObjectDelete(on);

}

}




//---

このようにします。

#property indicator_chart_window

#define  ONDA_BEGINS   0

#define  ONDA_CONTAINS 1


    int nLines = 40;                                   // Number of total line to draw

//+------------------------------------------------------------------+

//| Custom indicator initialization function                         |

//+------------------------------------------------------------------+

int init()

  {

//---- indicators


//----

   return(0);

  }

//+------------------------------------------------------------------+

//| Custom indicator deinitialization function                       |

//+------------------------------------------------------------------+

int deinit()

  {

//----

    for (int ix = 0; ix < nLines; ix++) // delete my horizontal lines

      {

      ObjectDelete("tensLines"+ix);

      }


//----

   return(0);

  }

//+------------------------------------------------------------------+

//| Custom indicator iteration function                              |

//+------------------------------------------------------------------+

int start()

  {


   double lineInterval = 0.0010;                      // Interval between lines

   double normPrice = NormalizeDouble(Close[1],3);    // Current price is rounded to nearest "10"


   for (int ix = 0; ix < nLines; ix++)                // Loop span number of times

      {

      if(ObjectFind("tensLines"+ix) < 0) 

         ObjectCreate("tensLines"+ix, OBJ_HLINE, 0, 0, normPrice+((ix-(nLines/2))*lineInterval));    // Place half above and half below the current price


      else ObjectSet("tensLines"+ix, OBJPROP_PRICE1, normPrice+((ix-(nLines/2))*lineInterval));

      ObjectSet("tensLines"+ix,OBJPROP_COLOR,DarkSlateGray);      // Make the lines look better

      }

 

//----

   return(0);

  }

//+------------------------------------------------------------------+


void ObjectNameDeleteAll(string name, int where=ONDA_BEGINS, int type=EMPTY)

{

    for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--)

    {

        string on   = ObjectName(iObj);

        int    iPos = StringFind(on, name);

        if (iPos < 0)                         continue;

        if (iPos > 0 && where == ONDA_BEGINS) continue;

        if      (type == EMPTY)         ObjectDelete(on);

        else if (type == ObjectType(on)) ObjectDelete(on);

    }

}



 
おい、みんな俺のためにパイソンでいくつかのコードを書くために誰かを雇うことを探して、誰かの仕事のために支払うことを喜んで、または誰かが無料でそれを行う場合は、それもクールだ(笑)しかし、いつでも私に戻って、誰かが私を助けることができれば私に知らせてください。 それは主にボリンジャーバンドと いくつかの他の指標になります。すべての助けをみんなありがとう
 
mladen:

こんな風に試してみてください

わああなたは男だ。mladenさん、祝福のお言葉ありがとうございます。

もう一つお願いがあります。下の添付ファイル/ピックのようにグリッドを長方形にしていただけませんか。 例えば1つの長方形に10ピップス長方形は未来を投影 させる。

デフォルトのグリッドよりも目に優しいような気がします。また、何pips動いているか確認するのに半瞬かかります。

    ObjectCreate("Rect02", OBJ_RECTANGLE, 0, Time[0], Bid, Time[Bars], (Bid+0.0010) ); //make bar above cur price
      ObjectSet("Rect02", OBJPROP_COLOR, Silver );
      }
//================= Move the Rect with new ticks/candles ===========================
   
   else {
      ObjectMove("Rect01", 0, Time[0], WindowPriceMin()*0.95);
      ObjectMove("Rect02", 0, Time[0], Bid); 

}

ファイル: