/*
CUSTOMIZE THE FOLLOWING TO GET YOUR OWN INDICATOR UP AND RUNNING 1) Add to the INPUT PARAMETERS the parameters you need for your signal, this can be a period for the RSI or Moving Average, the step for a PSAR and so on 2) Add some requirement checks in OnInitPreChecksPass if it is necessary to check the consistency of the parameters 3) Define in the IsSignal function at the end of the code the rule for your signal */ //-PROPERTIES-// //Properties help the software look better when you load it in MT4 //Provide more information and details //This is what you see in the About tab when you load an Indicator or an Expert Advisor #property link "https://www.earnforex.com/metatrader-indicators/alert-indicator-template/" #property version "1.0" #property strict #property copyright "EarnForex.com - 2019-2021" #property description "Alert Indicator Template" #property description "So You Can Create Your Own Indicator And Alerts" #property description " " #property description "WARNING : You use this software at your own risk." #property description "The creator of these plugins cannot be held responsible for any damage or loss." #property description " " #property description "Find More on EarnForex.com" //You can set an icon for the indicator to show when loading it on chart //Icon must have an ico extension and be located in the MQL4/Files folder, the following commented line is an example of icon #property icon "\Files\EF-Icon-64x64px.ico"
//-INPUT PARAMETERS-// //The input parameters are the ones that can be set by the user when launching the Indicator //If you place a comment following the input variable this will be shown as description of the field input string Comment1="========================"; //MQLTA Alert Indicator Template input string IndicatorName="MQLTA-AIT"; //Indicator Short Name input string Comment2="========================"; //Indicator Parameters //This is likely the only section you need to edit to adapt the indicator to your goal //For example if you are using RSI in you indicator you can add here the input for the period and the relevant levels inputENUM_CANDLE_TO_CHECK CandleToCheck=CURRENT_CANDLE ; //Candle To Use For Analysis input int BarsToScan=500; //Number Of Candles To Analyse input string Comment_3="===================="; //Notification Options input bool EnableNotify=false; //Enable Notifications Feature input bool SendAlert=true; //Send Alert Notification input bool SendApp=true; //Send Notification to Mobile input bool SendEmail=true; //Send Notification via Email input int WaitTimeNotify=5; //Wait time between notifications (Minutes) //Arrow Style can be chosen between Wingdings and preset arrows, see following URLs for all the codes //https://docs.mql4.com/constants/objectconstants/wingdings //https://docs.mql4.com/constants/objectconstants/arrows input string Comment_4="===================="; //Buffers Options input int ArrowTypeBuy=241; //Code For Buy Arrow input int ArrowTypeSell=242; //Code For Sell Arrow input bool ArrowShowNeutral=false; //Show Stop Arrow input int ArrowTypeStop=251; //Code For Stop Arrow input color ArrowColorBuy=clrGreen; //Color For Buy Arrow input color ArrowColorSell=clrRed; //Color For Sell Arrow input color ArrowColorStop=clrGray; //Color For Stop Arrow input ArrowSize=CANDLE_SIZE_MEDIUM; //Size Of The Arrows input ENUM_CANDLE_DISTANCE CandleDistance=CANDLE_DISTANCE_NEAR; //Arrow Distance From Candle
How to Use Template?
Add the input parameters for your entry or exit. OnInitPreChecksPass()
function contains the code to check the validity of the input parameters — you can add your checks here. Add your data to evaluate and the entry/exit rules to the IsSignal().
//The IsSignal function is where you check if the candle of index i has a signal //it can return SIGNAL_BUY=1, SIGNAL_SELL=-1,SIGNAL_NEUTRAL=0 //This functions is where you define your signal rulesENUM_TRADE_SIGNAL IsSignal (inti ){ //Define a variable j which is the index of the candle to check, this is to consider if you are checking the current candle or the closed one intj =i +Shift ; //Initialize the Signal to a neutral/stop oneENUM_TRADE_SIGNAL Signal =SIGNAL_NEUTRAL ; //Define all the values that you are going to need to check your signal rules first //Define the condition for your buy signal and assign SIGNAL_BUY value to the Signal variable if the condition is true //Define the condition for your sell signal and assign SIGNAL_SELL value to the Signal variable if the condition is true //Define the condition for your stop/neutral signal and assign SIGNAL_NEUTRAL value to the Signal variable if the condition is true //Defining a stop/neutral condition is not always necessary, many systems work with only Buy and Sell //Return the Signal and exit the function returnSignal ; }
Комментариев нет:
Отправить комментарий