Cross Script for MetaTrader 5 | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources

Simple code for candle crossover above or below condition..
mt4 version:- https://www.mql5.com/en/code/27596
NOTE: This is just an example
boolean cross[ 2 ]; //+------------------------------------------------------------------+ intOnInit() { for (int i = 0; i < ArraySize(cross); i++) intersection[i] = true; return (INIT_SUCCEEDED); } //+------------------------------------------------------------------+ InvalidOnTick() { if(CopyOpen(Symbol(), PERIOD_CURRENT, 0, 2, Open) <= 0) return; ArraySetAsSeries(open, true); //Your buying condition if(cross(0,open[0]>condition)) { ....//Your conditions//... } //Your selling condition if (cross(1, open[0] < condition)) { ....//Your conditions//... } } //+------------------------------------------------------------------+ bool Cross(int i, bool condition) { bool ret = condition&& !crossed[i]; crossed[i] = condition; return(ret); }

Attachment download
📎 cross.mq5 (35.33 KB)
Source: MQL5 #27597
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •