Help regarding modification in "Simple Trend Robot"

Created at 22 Feb 2013, 19:37
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!
susantasaren's avatar

susantasaren

Joined 19.02.2013

Help regarding modification in "Simple Trend Robot"
22 Feb 2013, 19:37


According to the conditions of "Sample Trend Robot" it opens and closes position immediately when the SMA crosses each other.

What I want is that the robot should check two conditions before opening and closing positions. They are:-

1) SMA Crosses each other and remain crossed in Last Candle and 

2) Buy and Sell Order only takes place in New Candle Opening.

Can anyone code this thing.

Thanks.


@susantasaren
Replies

cAlgo_Fanatic
26 Feb 2013, 10:17

RE:
susantasaren said:

According to the conditions of "Sample Trend Robot" it opens and closes position immediately when the SMA crosses each other.

What I want is that the robot should check two conditions before opening and closing positions. They are:-

1) SMA Crosses each other and remain crossed in Last Candle and 

2) Buy and Sell Order only takes place in New Candle Opening.

Can anyone code this thing.

Thanks.

Therefore the only difference is that the SMA remain crossed for a while before a new order is requested? If so, for how many bars should they remain crossed?

You may want to look into the functions HasCrossedAbove/HasCrossedBelow.

 


@cAlgo_Fanatic

susantasaren
26 Feb 2013, 23:56

RE: RE:
cAlgo_Fanatic said:
susantasaren said:

According to the conditions of "Sample Trend Robot" it opens and closes position immediately when the SMA crosses each other.

What I want is that the robot should check two conditions before opening and closing positions. They are:-

1) SMA Crosses each other and remain crossed in Last Candle and 

2) Buy and Sell Order only takes place in New Candle Opening.

Can anyone code this thing.

Thanks.

Therefore the only difference is that the SMA remain crossed for a while before a new order is requested? If so, for how many bars should they remain crossed?

You may want to look into the functions HasCrossedAbove/HasCrossedBelow.

 

This Image will explain what I want.


@susantasaren

susantasaren
27 Feb 2013, 06:25

RE: RE:
cAlgo_Fanatic said:
susantasaren said:

According to the conditions of "Sample Trend Robot" it opens and closes position immediately when the SMA crosses each other.

What I want is that the robot should check two conditions before opening and closing positions. They are:-

1) SMA Crosses each other and remain crossed in Last Candle and 

2) Buy and Sell Order only takes place in New Candle Opening.

Can anyone code this thing.

Thanks.

Therefore the only difference is that the SMA remain crossed for a while before a new order is requested? If so, for how many bars should they remain crossed?

You may want to look into the functions HasCrossedAbove/HasCrossedBelow.

 

Thanks. HasCrossedAbove and HasCrossedBelow functions solves my purpose. :)


@susantasaren