Pls help me just enough to highlight my chart in 2 colours when a condition as simple as ma1>ma2 and ma1<ma2 is fulfilled.

 

I know this language just enough to code EA based on given indicators and condition, and nothing about coding indicators or scripts.


So i was studying few of my backtests to find few logical errors. and it would be helpful if my chart was highlighted in red or green when conditions ma1>ma2 and ma1<ma2 are fulfilled.


Pls help me by giving a few lines to add to my EA which may highlight my chart according to the given conditions.

 
One possible way is to use printf() so you see it in the log output.

Your request is very hard to understand.

Maybe it helps to read some code from the codebase so you get a better understanding of how to use mql5.
 
Dominik Egert:
One possible way is to use printf() so you see it in the log output.

Your request is very hard to understand.

Maybe it helps to read some code from the codebase so you get a better understanding of how to use mql5.
normal backtesting chart how I intend my chart to look during backtesting



perhaps now you can get what I am saying. This EA places pending order at every MA crossing so it looks like the first image during backtesting. But i want it to get colored at these crossings as shown in second image.

 
Dominik Egert:
Ok.

I am not so much into Chart draw, but it looks like a rectangle that has been drawn with some alpha value for transparency.

ChartObjectCreate() should help you.

Same here.

I am also not into these chart operations.

but I'll look into this ChartObjectCreate() .

Thanks.

 
saurabhsuman003:



perhaps now you can get what I am saying. This EA places pending order at every MA crossing so it looks like the first image during backtesting. But i want it to get colored at these crossings as shown in second image.

OK.


I am not so deep into ChartDraw(), but it looks like a rectangle that has been drawn with some alpha value for transparency.

You are (I suppose) looking for something like this:

https://www.mql5.com/de/docs/objects/objectcreate


Regards

Dokumentation zu MQL5: Graphische Objekte / ObjectCreate
Dokumentation zu MQL5: Graphische Objekte / ObjectCreate
  • www.mql5.com
ObjectCreate - Graphische Objekte - Nachschlagewerk MQL5 - Nachschlagewerk über die Sprache des algothitmischen/automatischen Handels für MetaTrader 5
Reason: