I am trying to create a simple script to capture the beginning of the trend resumption,
so I want to compare two EMAs 17 and 72, to see if one is bigger than other. So if the price reaches the EMA 72, I want to enter a buy order.
Here is the script that I have written, there is no compile error but there is no action when simulation or backtesting.
protected override void OnBarUpdate()
{
// Condition set 1 Long
if (EMA(17)[0] > EMA(72)[0] && Position.MarketPosition == MarketPosition.Flat && Close[0] == EMA(72)[0])
{
EnterLong(Posicao, "Long");
}
Can anyone help me?
Thanks and best regards

Comment