Forum

Replacing a loop with CopyRates()?

Hey guys, I made this little test code which copies the sizes of all candles in an array and sorts the array. Currently I am doing this with a normal loop. I was wondering if there is another way which might be more efficient using CopyRates(). The whole topic with CopyRates(), CopyBuffer() is a bit

MT5 build 5100 causes problems with my code

Hey guys, I use a scanner and when certain situations in the market happen, this scanner saves a screenshot with lines and annotiations and copies it into my own Telegram channel which is just for me. Unfortunately I have absolutely no idea how this Telegram API code works. I just found it freely

Commission of a running position

Hello guys, I made this script but it only shows 0.0 as a result when I drag the script into a chart with a running position. Can somebody tell me what's wrong with the code? void OnStart () { for ( int i= 0 ;i< PositionsTotal ();i++) { string symbol= PositionGetSymbol (i); if

How do you assess if a spread is (relatively) large or small?

Hello guys, I am not sure how to assess if a spread is large or small. I tried to compare it with the average daily range and I also compared the spread to the value of the currency itself. What makes most sense for you? It is not only the points because 3 points are not the same on EURCHF or GBPJPY

Two colors in an indicator with one buffer possible?

Hey guys, I made a small indicator which shows inside candles. Now I want to check if the candle's close is above or below the open price and I want to change the color of the dot accordingly. I know how to do this with two buffers but I want to know if it's possible with one buffer and how I could

Problem with the loop of an indicator

Hey guys, I will never understand how the loop of an indicator works. It's easy when I calculate the whole indicator with every tick but it should be a bit more efficient. Only the new bars should be calculated. I read many articles about prev_calculated , rates_total and so on. But obviously I am

How can I check if a position was closed by the stoploss?

Hello guys, I want to make an expert which checks if a position was closed by the stoploss. As soon as a position is closed by a stoploss I want to be noticed by an Alert. What is the best way to do this? Would you check the order-history with every tick or is it the better way to use OnTrade() or

Import real stock data for backtests into MT5 possible?

Hello guys, I just opened a MetaQuotes demo account because they offer real time stock data from the NASDAQ but I saw that the quality of the EOD data is not the best (daily open and close is very often different from other data sources like nasdaq.com). I don't want to trade stocks with the MT5 but

Checking CHARTEVENT_KEYDOWN doesn't work with '+' and '-'

Hey guys, Can someone tell me why it's not possible to check if + or - is pressed in CHARTEVENT_KEYDOWN ? It doesn't work with if (lparam=='+') and it doesn't work with if (lparam==char(189)) either. But why? How can I check if these keys are pressed

How can I update a CSV file without overwriting it?

Hello guys, can someone tell me how to update a file without overwriting it? I made a small script which saves the current time to the file TEST.CSV. This script overwrites the file before but I want it to add the current time to the existing file so when I execute the script 5 times I want to see 5