Forum

Modify all running trades after one stoploss was changed

Hi guys, I have a couple of running trades on one instrument. Now I move the stoploss of one order closer to the current price by dragging the stoploss line in the chart. An EA should notice that and change all other stoplosses to the same stoploss price. Because there is no event for modifying an

Logic of a loop counter in a for-loop

Hi coders, I have 10 objects in my chart. If I pop-up an alert with ObjectsTotal() the result is 10. When I want to color them all in green I do it this way: for ( int i= ObjectsTotal (); i> 0 ; i--) { ObjectSetInteger ( 0 , ObjectName ( 0 , i), OBJPROP_COLOR , clrGreen ); } Now my question is

Question about OBJPROP_TIMEFRAMES

Hi, I made a small script which should tell me if a horizontal line is visible in the current timeframe . The line I plotted is only visible on H1 but whatever timeframe I choose I always get "true" as a response. I doubt that bool is the correct initialization because there are no timeframe-flags

Question about OBJ_EDIT

Hi coders, is it somehow possible to delete the text in an OBJ_EDIT when clicking on it? I want to avoid a label as a description for that edit box and so I want to place the description right inside the edit box which should disappear when I click on it. I tried it this way but it doesn't work

How to programatically minimize a chart window?

Hey coders, I found a code about how to maximize a chart window by using SendMessage but I can't find something like WM_MDIMINIMIZE. I googled it but I didn't find a command to minimize a window. Can someone help me? This script is working fine to maximize a chart and I figured out that

How to find out the active chart window?

Hi coders, if I have opened 20 charts I only want some calculations done on the chart I am currently watching. So it might be useful for an indicator to check if a chart is currently active. I found a solution here: https://forum.mql4.com/30084#276651 but this posting is from 2010 and I wanted to

Force a tick by calling OnCalculate() from a chart event

Hey coders, sometimes I need a tick, may it be on a weekend or during quiet market times. I thought about forcing a tick by calling OnCalculate() from a chart event. This was my first idea: void OnChartEvent ( const int id, const long &lparam, const double

Problem with the delay of ChartSetSymbolPeriod()

Hi coders, the H1 chart is open. Now I would like to have screenshots from H1, M15 and H4. I do it this way: ChartScreenShot ( 0 , _Symbol +( string ) _Period + ".png" , 1280 , 720 ); ChartSetSymbolPeriod ( 0 , NULL , PERIOD_H4 ); ChartScreenShot ( 0 , _Symbol +( string ) _Period + ".png" , 1280

Line touch alarm without checking all objects on each tick?

Hello, right now I am checking all objects on each tick and if the object is a horizontal line starting with the keyword 'alert' and it is touched by the current price , it sends an alert to my smartphone. Works perfect so far. Now I sent it to a friend and he has a lot of charts open and uses a lot

Moneymanagement / currency problem with gold, indices, commodities

Hi forum, I am using the following lotsize calculation: double moneyRisk = AccountBalance()*percentRisk* 0.01 ; double lotSize = moneyRisk / (entry-sl)*dir / (MarketInfo( NULL , MODE_TICKVALUE)/MarketInfo( NULL , MODE_TICKSIZE)); lotSize = MathFloor (lotSize/MarketInfo( NULL