How to code Candle and MA crosses
How to code Candle and MA crosses
29 Sep 2018, 21:02
Hello
I would appreciate if you help with codes on these matters:
1. how to properly enter code of Candle closing inside a Moving Average? To be precise, candle crosses MA and closes inside triggering an buy or sell entry.
2. the same about two moving averages. a) one MA touching another MA b) one MA crossing another MA. What code commands should we use.
cheers...
Replies
PanagiotisCharalampous
04 Oct 2018, 10:40
Hi tekASH,
Yes it can be used for MA crossing another MA. However I do not understand what do you mean when you say candle closing inside MA. Can explain a bit more what do you consider to be inside an MA, maybe with a screenshot?
Best Regards,
Panagiotis
@PanagiotisCharalampous
tekASH
04 Oct 2018, 11:57
( Updated at: 21 Dec 2023, 09:20 )
RE:
Like this.
Panagiotis Charalampous said:
Hi tekASH,
Yes it can be used for MA crossing another MA. However I do not understand what do you mean when you say candle closing inside MA. Can explain a bit more what do you consider to be inside an MA, maybe with a screenshot?
Best Regards,
Panagiotis
@tekASH
PanagiotisCharalampous
04 Oct 2018, 15:19
Hi tekASH,
Thanks for the screenshot but I still do not understand how you define "inside".
Best Regards,
Panagiotis
@PanagiotisCharalampous
nordic
07 Oct 2018, 02:58
RE: RE:
tekASH said:
Thx. Can this also be used for moving averages? One MA crossing another MA?
Also, how about candle closing inside MA , after crossing it.
Tekash,
HasCrossedAbove and HasCrossedBelow will return a boolean true or false when it is called by comparing two dataseries, in this case the resulting dataseries from a primary and secondary indicator. The function will only work with dataseries inputs.
For candles closing either side of an MA (ie, buy when a bull candle closes above and sell when a bear candle closes below), you'd want to build a function that determines the candle colour, determines where the open and close prices are, and executes when the closing price of the last candle is above or below the MA last value. You'd also probably want to construct it such that it won't continue to open orders once an order is placed.
My advice would be to read up on the API as it's all pretty well documented, and hit up YouTube for all the C# coding how-tos if you're a beginner. There's a wealth of stuff out there to get you going.
@nordic
tekASH
07 Oct 2018, 20:18
RE:
Panagiotis Charalampous said:
Hi tekASH,
Thanks for the screenshot but I still do not understand how you define "inside".
Best Regards,
Panagiotis
simple..candle crosses a MA, and its closing price line, the body, (not wicks) stays inside that MA not crossing back.
@tekASH
tekASH
07 Oct 2018, 20:20
RE: RE: RE:
nordic said:
tekASH said:
Thx. Can this also be used for moving averages? One MA crossing another MA?
Also, how about candle closing inside MA , after crossing it.
Tekash,
HasCrossedAbove and HasCrossedBelow will return a boolean true or false when it is called by comparing two dataseries, in this case the resulting dataseries from a primary and secondary indicator. The function will only work with dataseries inputs.
For candles closing either side of an MA (ie, buy when a bull candle closes above and sell when a bear candle closes below), you'd want to build a function that determines the candle colour, determines where the open and close prices are, and executes when the closing price of the last candle is above or below the MA last value. You'd also probably want to construct it such that it won't continue to open orders once an order is placed.
My advice would be to read up on the API as it's all pretty well documented, and hit up YouTube for all the C# coding how-tos if you're a beginner. There's a wealth of stuff out there to get you going.
What is DataSeries in thi case, I need detailed explanation plz..for instance, sample coe of one MA crossing another MA.
2. if you coul give hint of sample code of you rporpsoeal, Id appreciate.
@tekASH
PanagiotisCharalampous
02 Oct 2018, 11:14
Ηι tekASH,
the followng methods should be helpful for you
HasCrossedAbove
HasCrossedBelow
Best Regards,
Panagiotis
@PanagiotisCharalampous