Home MT4 Indicator Programming Primer (7) Judgment Statements

MT4 Indicator Programming Primer (7) Judgment Statements


MT4 Indicator Programm cashback forexg Primer: Usage of Judgment Statements if Statements if Statements are commonly used and relatively simple Rules: If the condition in parentheses holds, then execute the cashbackforexbroker in parentheses; if not, then skip the parentheses Example: if(a== cashbackforexexness) { b=c+1; } We often use th forexrebateclub statement when writing forex rebate club indicators If "price goes up to the specified price level", then "alarm" If "MACD goes up", then "alarm " If the "mean cross", then "alarm", etc. Example: intmark=0; if(High[1]<1.0000&&High[0]> =1.0000&&mark!=1) { Alert(symbol(), "Price up to touch 1.0000"); mark=1; } if(Low[1]>1.0000&&Low[0]<=1.0000&&mark!=2) {  Alert(symbol(), "Price down to 1.0000"); mark=2; } This is a judgment statement to alert when the price crosses 1.0000 up or down: Up alarm condition: when the second K-line maximum price is less than 1.0000, and the latest K-line maximum price is greater than or equal to 1.0000 Down alarm condition: when the second K-line minimum price is greater than 1.0000, and the latest K-line minimum price is less than or equal to 1.0000 Here, mark is used as an alarm mark, the initial value of mark is 0, when the upper penetration alarm, the value of mark will be changed to 1; when the lower penetration alarm, the value of mark will be changed to 2; when mark = 0, it means that the alarm has never been reported, the upper and lower penetration can be alarmed; when mark = 1, it means that the upper penetration alarm has been reported When mark=2, it means that the alarm has already been reported in the lower part of the alarm, and the alarm can no longer be reported in the lower part of the alarm, but it can still be reported in the upper part of the alarm if. .else statement Rule: If the condition in parentheses is valid, then execute statement 1 in parentheses under if; if not, then execute statement 2 in parentheses under else if(condition) { statement 1; } else { statement 2; } Note Only the statement terminator ";" is used after the statement. If there is only one line of statement, the curly brackets can be omitted. For more information on MT4 programming, please visit MT4.com

Link to this article:https://www.360tradebay.com/4764.html

Copyright © 2012-2021 https://www.360tradebay.com - forex rebate club
Back to top