Forum

How to calculate loss/win for a index trade?

Good morning Community! I am struggling to calculate the loss/win of a trade for the SP500 when account currency is in EUR. DAX example: Buy in: 12000, Buy out: 12050 -> 50 Points; My Broker sets 1 Point equal to 25 EUR. Having a lot size of 0.1 the win is: 50 * 25 * 0.1 = 125 EUR The same way, I

How to get index of last element in array / index of the first empty value?

Hello! is there a quick and nice way to get the index of the last element in an array or the index of the first empty value? One way of course would be the use of an index variable but maybe there is a better way. I also tried ArraySize but I initialize my Arrays at the beginning with a size of i.e

Split Array

Good afternoon! I am struggling to split an Array (A) of Size e.g. 10 into two other Arrays (B and C). Array B should contain all even elements of A and C, apparently, all odd elements of A. Example: A = [5, 4, 7, 2, 9, 6, 8, 11, 25, 17} -> B = [5, 7, 9, 8, 25] C = [4, 2, 6, 11, 17] Best

MathRound fails for one particular number

Good evening! I am using MathRound (Double, 2 ); to round a couple of doubles to two decimal places. Works, apart from one double: 2017.12 . 31 19 : 20 : 12.891 2017.01 . 02 08 : 00 : 00 Rounded Double: 0.17 2017.12 . 31 19 : 20 : 12.891 2017.01 . 02 08 : 00 : 00 Rounded Double: 0.13 2017.12

Suppress print out from CTrade Sell and Buy functions

Hey hey! is it possible to suppress the print Outs from the CTrade sell and buy functions ? Here is my code: m_trade.Sell( 0.1 , _Symbol ,last_tick.ask,last_tick.ask+SL,last_tick.ask-TP This produces the following print out in back tester's Journal: 2017.12 . 15 14 : 24 : 15.762 2017.01 . 02 08 : 00

FolderDelete using TERMINAL_DATA_PATH

Hi, I try to delete, for instance, the file Folder as follows: working_folder= TerminalInfoString ( TERMINAL_DATA_PATH )+ "\\MQL5\\Files" ; FolderDelete (working_folder); Print out returns the following string: C:\Users\wolfg\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-

Border Color Rectangle / Button

Hi! the following code draws a rectangle. However, the border color seems to have no effect for object rectangle: ObjectCreate ( 0 ,HR_UP, OBJ_RECTANGLE , 0 , TimeCurrent (),RL, TimeCurrent (),SL); ObjectSetInteger ( 0 ,HR_UP, OBJPROP_FILL , true ); ObjectSetInteger ( 0 ,HR_UP, OBJPROP_BACK

Adjust price scale to keep current price in the middle of the chart

Good evening Folks! in the left upper corner of the chart I print a lot of trading information. As soon as the price climbs far enough, the information I print is completely screwed up by the bars crossing the text. That is why I was wondering whether there is the possibility to adjust the price

BUG in Canvas Class?

Hiya, I recently asked about the canvas class: https://www.mql5.com/en/forum/216442 I spent quite some time now to get into this class and its functions, however I am still struggling to get a BMP drawn. I found the following post: https://www.mql5.com/en/forum/157832#comment_3808455 At the very end

Drawing Shapes/Objects using the Canvas Class

Folks! I looked at the Canvas class to use its power for simplified drawing of shapes and objects. However, I am struggling to create any visible shape. I searched through the forum and found this post: https://www.mql5.com/en/forum/216195 This looks like a very basic example so I gave it a try