Code request HELP

 

Hi there,

I wonder if someone has some code or can develop a code with the following conditions: (trend following)

Moving Average:

- Period: 90

- Shift: 0

- Mode: Simple

The code must test the candlestick bar status for 2 different timeframes: 1H and 4H

Rules:

NO ORDER: Wait for the candlestick cross the MA on 1H time frame

BUY: When there is a candlestick totally above the MA on 1H time frame (lower price of candlestick of the closed bar above the MA) it must check on 4H timeframe if the candlestick is also totally above the MA (lower price of candlestick of the closed bar above the MA).

SELL: When the candlestick totally bellow the MA on both 1H and 4H time frames.

So, I need:

- A function that returns a value if the NO ORDER condition is found;

- A function that, when NO ORDER condition is false, returns another value when the candlestick is totally above MA on both 1H and on 4H

- A function that, when NO ORDER condition is false, returns another value when the candlestick is totally bellow MA on both 1H and on 4H

Can anyone help me?

Regards

Reason: