Forum

Help, TrailingStop function cannot be executed in my EA

Hi Guys, I created an EA but TrailStop() function cannbe be executed in the main fuction. I checked several times but couldn't find out the bug. Could you help me debug it? Thanks... My thread is simple. No profit target set when sending out an order and trigger TrailStop() when getting 40 pips

How to call color of indicator in EA??

Dears, Here I encounter a problem when I want to call the color out of my custom indicator . For example, I have a trendline in changing color. Green means uptrend and Red meand downtrend. When the color changes from red to green, place buy and vice versa. The question is how to call the color or

How to check a new bar?

I see a coding as below to check the formation of a new bar but I am not aware why when the expression if(New_Time!=Time[0]) return ture, a new bar is deemed to be formed. New_Time is defined as 0, but Time[0] returns to date, eg. 2009.11.01 14:34. They should not be equal to always. Thanks for your

Sheep counting - But I cannot, could you help me??

Dear friends, This is a sample regarding the usage of operator "continue" from https://book.mql4.com/operators/continue . I have a slight change in the coding resulting in different outputs. Could you enlighten me how the difference occur? Problem 16. There are 1000 sheep on the first farm. The

Why no drawing for my indicator sometime??

I simply code an indicator as below. When it is embeded into MT4, sometimes the drawing line can be reflected in the screen sometimes is empty. It really makes me confused. Any wrong with my coding? Or 3 arrays slow down the caculating speed? Can someone kindly give me a hand? Thanks a lot