当前位置:网站首页>Mt4/mql4 getting started to proficient in foreign exchange EA automatic trading tutorial - special identification of the K line on the chart

Mt4/mql4 getting started to proficient in foreign exchange EA automatic trading tutorial - special identification of the K line on the chart

2022-06-22 08:02:00 EA development - green shirt code customer

EA It can be done to K Line for identification , And output on the icon , In order to facilitate the resumption , Also on EA More intuitive understanding of the implementation of , It can be done to EA Detailed optimization of the entrance and exit of .

The effect is as follows

 Insert picture description here
Custom method SignalBar

void SingalBar(int myBarPos,double myPrice)
  {
   string TextBarString=Time[myBarPos];
   // stay K A sign is displayed above the highest price of the line 
   switch(Digits()){
      case 0:{myPrice=myPrice+55;break;}
      case 1:{myPrice=myPrice+5.5;break;}
      case 2:{myPrice=myPrice+0.55;break;}
      case 3:{myPrice=myPrice+0.055;break;}
      case 4:{myPrice=myPrice+0.0055;break;}
      case 5:{myPrice=myPrice+0.00055;break;}
   }
   // Generate a thumbdown logo OBJ_ARROW_THUMB_DOWN
   ObjectCreate(TextBarString,OBJ_ARROW_THUMB_DOWN,0,Time[myBarPos],myPrice);
   ObjectSetInteger(0,TextBarString,OBJPROP_HIDDEN,true); 
   ObjectSetInteger(0,TextBarString,OBJPROP_COLOR,Blue);
  }  

Write a script to execute

//+------------------------------------------------------------------+
//| BarText.mq4 |
//| Copyright 2021, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
  {
    
//---
   SingalBar(1,High[1]);
  }
//+------------------------------------------------------------------+


void SingalBar(int myBarPos,double myPrice)
  {
    
   string TextBarString=Time[myBarPos];
   // stay K A sign is displayed above the highest price of the line 
   switch(Digits()){
    
      case 0:{
    myPrice=myPrice+55;break;}
      case 1:{
    myPrice=myPrice+5.5;break;}
      case 2:{
    myPrice=myPrice+0.55;break;}
      case 3:{
    myPrice=myPrice+0.055;break;}
      case 4:{
    myPrice=myPrice+0.0055;break;}
      case 5:{
    myPrice=myPrice+0.00055;break;}
   }
   // Generate a thumbdown logo OBJ_ARROW_THUMB_DOWN
   ObjectCreate(TextBarString,OBJ_ARROW_THUMB_DOWN,0,Time[myBarPos],myPrice);
   ObjectSetInteger(0,TextBarString,OBJPROP_HIDDEN,true); 
   ObjectSetInteger(0,TextBarString,OBJPROP_COLOR,Blue);
  }  

A good workman does his work well , You must sharpen your tools first , The most important thing in trading is to follow the rules , Strictly carry out . Official account , Study MQL Beginner to master EA course , Learn more EA Programming , Write your own EA, Forge your own magic weapon .
 Insert picture description here

原网站

版权声明
本文为[EA development - green shirt code customer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202220530130899.html