Code Library / Support/Resistance
MQL4 Round Number Levels
Plot psychological round number price levels.
Language: MQL4 · Category: Support/Resistance · Tags: round numbers, psychological levels, MQL4, support resistance, price levels
Source code
input double Step=0.0100; input color Clr=clrGold;
void DrawRoundLevels() {
ObjectsDeleteAll(0,"RN_");
double top=WindowPriceMax(), bot=WindowPriceMin();
for(double p=MathFloor(bot/Step)*Step;p<=top;p+=Step) {
string n="RN_"+DoubleToStr(p,Digits);
ObjectCreate(0,n,OBJ_HLINE,0,0,p);
ObjectSetInteger(0,n,OBJPROP_COLOR,Clr);
}
}How to use this snippet
This is a building block, not a finished trading system. Paste it into your own MQL4 project, compile it, and test it on a demo account with your broker's real spreads before relying on it. If MetaEditor reports errors, the compilation error fixer can help.