Cross line from below or above.

Created at 26 Sep 2023, 23:01
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
RD

rdebacker

Joined 06.07.2023

Cross line from below or above.
26 Sep 2023, 23:01


Hello,

In Prorealtime there are built-in commands for crossing a line (say for exmple a Pivot Point line) from below or above. The intent is to use it as a trigger for opening a position.

Is there a way in C# and cTrader Automate to do the same.

 

I've tried many things but did not yet find a solution that is full-proof like in Prorealtime.

 

Thanks in advance for any help.

 

Kind Regards

Rafael


@rdebacker
Replies

PanagiotisChar
27 Sep 2023, 04:59

Hi there, 

There aren't any built in commands. You would need to write your own code to check crosses above below the line levels


@PanagiotisChar

rdebacker
27 Sep 2023, 08:19

Thanks for your reply.

 

Somebody found a code sample in the past that can be used for this?

 

Thank you

 

Rafael


@rdebacker

levd20
07 Sep 2024, 01:30

RE: Cross line from below or above.

should be something like

//cross above

if(Bars.ClosePrices.Last(0) ≥ myIndicator.Last(0) && Bars.ClosePrices(1) < myIndicator.Last(0))

{
// do stuff

ExecuteMarketOrder…

}
 

 

rdebacker said: 

Thanks for your reply.

 

Somebody found a code sample in the past that can be used for this?

 

Thank you

 

Rafael

 


@levd20

levd20
07 Sep 2024, 01:31

RE: Cross line from below or above.

should be something like

//cross above

if(Bars.ClosePrices.Last(0) ≥ myIndicator.Last(0) && Bars.ClosePrices(1) < myIndicator.Last(1))

{
// do stuff

ExecuteMarketOrder…

}
 

 

rdebacker said: 

Thanks for your reply.

 

Somebody found a code sample in the past that can be used for this?

 

Thank you

 

Rafael

 


@levd20