MQL4/5 Coders needed for very simple formulas in Custom Code Block
-
Hello,
I am now actively using the Custom Code Block since @jstap has introduced me to the concept.
I was able to reduce the number of blocks to a great extent for trading multiple pairs based on Currency Strength.
For example:
In order to get values of close, High, Low, I type:EURUSD_Change_D1=(iClose("EURUSD",PERIOD_D1,0)-iLow("EURUSD",PERIOD_D1,0))/(iHigh("EURUSD",PERIOD_D1,0)-iLow("EURUSD",PERIOD_D1,0))*100;
EURGBP_Change_D1=(iClose("EURGBP",PERIOD_D1,0)-iLow("EURGBP",PERIOD_D1,0))/(iHigh("EURGBP",PERIOD_D1,0)-iLow("EURGBP",PERIOD_D1,0))*100;
EURJPY_Change_D1=(iClose("EURJPY",PERIOD_D1,0)-iLow("EURJPY",PERIOD_D1,0))/(iHigh("EURJPY",PERIOD_D1,0)-iLow("EURJPY",PERIOD_D1,0))*100;This helped me a lot in reducing the number of blocks. The same functions/formulas worked in MQL4 and MQL5
Now I have three questions please:
First: What should I type in the Custom Block to reduce the number of trading orders? for MT4 and MT5
I want to execute Buy and Sell orders inside the blcok for MT4 and I used this successfully:{OrderSend(Symbol(),OP_BUY,0.1,Ask,2,Bid - SL10Point, Bid + TP10Point);}
return;However, the order gets executed more than once and I have no clue how to limit the number of trades per individual Pair (and per Buys and per Sells).
I tried the (Check Trades Count Block) and placed it just above the Custom MQL4 Code Block but this did not help.
In case anyone asks why not use theBuy, Sell Blocks. The reason is that there is little in common. The "Set for Current Markets" Block will not help.Second: The Symbol() only works for the current chart. But I instead want to for ex, Buy EURCAD and EURJPY. So I need to type Symbol (EURCAD) and Symbol (EURJPY). This however did not work.
Third: I was not able to successfully use the same formulas to get indicators values. For example, I tried iMACD and iRSI with the right parameters.
EURUSD_iOsMA=iOsMA("EURUSD",PERIOD_D1,12,26,9,0,0);
What is the right function/formula for each MT4 and MT5?
Just put me on the first steps ...
Thanks,