Forum

Counting trades for risk control

Hello Guys, I made a bool function to count my positive and negative trades daily, if there is more then 3 it returns true. In backtesting it works because all positionated volume closes at once. In real trades, the volume is closed in parts, so the function counts more then 1 positive trade and

Timeframe (60 minutes) Moving average inside Timeframe (5 minutes)

Hello, I'm trying to add a SMA with 20 periods from 1 hour chart to a 5 minutes chart. Tried to use the function IndicatorAdd but it didn't work... Any advices? #include <Charts\Chart.mqh> CChart grafic; int average_handle; //--- input parametrs input ENUM_TIMEFRAMES InpTimeFrame= PERIOD_H1 ;

Add EA's indicator on chart

#include <Charts\Chart.mqh> CChart grafic; int average_handle; //--- input parametrs input ENUM_TIMEFRAMES InpTimeFrame= PERIOD_H1 ; // Timeframe input ENUM_MA_METHOD InpMethod= MODE_SMA ; // Method input int InpPeriod= 20 ; // Period input int

No value shown in DataWindow

I have a doubt on my new indicator... All the calculations are correct but sometimes an error accours, there is no value on DataWindow and the indicator's line disappear. I used the following function to set to zero in case of errors but didn't work. Any help? PlotIndexSetDouble ( 0

Indicator wrong loop

#include <MovingAverages.mqh> #property indicator_separate_window #property indicator_buffers 2 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 Blue #property indicator_label1 "Diference" //--- global variables int InpMAPeriod= 20 ;

Doubt in OnCalculate

I'm trying to create a new indicator that calculates the sum of a array (matrix of 5 symbols with correlation) and divides by a specified number. The calculation is correct, but i'm having problems with the indicator plot. Probably in the OnCalculate part. i want the indicator look like a moving