RightEdge Forums
Main     Home          Members     Calendar     Who's On

Welcome Guest
        



How to code for a MACD Crossover after it has... Expand / Collapse
Message
Posted 2/9/2010 09:16:48 Post #10746
 

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie
Hi,
I am new to RightEdge Trading System and its built in Indicators. I am just getting started . I would like to know if there is a way, I can code for an Entry Position, after a MACD CrossOver based on the condition that MACD.Diff shold be greater than 0.1. In other words, I don't want to enter immediately on crossover but after MACD.Dif reaches 0.1 or higher.
Please help me out on how I can achieve this.
Thanks,
Sudharsan
Posted 2/9/2010 09:54:04 Post #10750
 

Lead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead Developer
I assume the diff is between 1 period? So you would have MACD.Current and MACD.LookBack(1). Then it would be a simple comparison ... something like.

if (MACD.Current - MACD.LookBack(1) > 0.1)
{
OpenPosition
}

sudharsanv (2/9/2010)
Hi,
I am new to RightEdge Trading System and its built in Indicators. I am just getting started . I would like to know if there is a way, I can code for an Entry Position, after a MACD CrossOver based on the condition that MACD.Diff shold be greater than 0.1. In other words, I don't want to enter immediately on crossover but after MACD.Dif reaches 0.1 or higher.
Please help me out on how I can achieve this.
Thanks,
Sudharsan
Posted 2/9/2010 10:11:34 Post #10751
 

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie
Hi bilb,
Thank you. But how to combine it with the MACDCrossOver condition?.
I don't want to check for MACD CrossOver on each and every bar. Suppose MACD crossover occurs at end of bar1. And suppose at end of bar4, the Macd.Diff reaches 0.1 or higher, I want to enter on open of bar5.
I am understanding yor IF code to mean, test the strength of MACD.Diff() between any 2 consecutive bars. How to add the condition to this saying, test the strength but ONLY after a MACD Crossover has occurred?
Thanks,
Sudharsan.
Posted 2/10/2010 08:10:04 Post #10765
 

Lead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead DeveloperLead Developer
Then set a flag in your code. If the crossover occurs set your flag to true. Then when the difference reaches your threshold, open your position.

sudharsanv (2/9/2010)
Hi bilb,
Thank you. But how to combine it with the MACDCrossOver condition?.
I don't want to check for MACD CrossOver on each and every bar. Suppose MACD crossover occurs at end of bar1. And suppose at end of bar4, the Macd.Diff reaches 0.1 or higher, I want to enter on open of bar5.
I am understanding yor IF code to mean, test the strength of MACD.Diff() between any 2 consecutive bars. How to add the condition to this saying, test the strength but ONLY after a MACD Crossover has occurred?
Thanks,
Sudharsan.
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: billb, young, dplaisted

Permissions Expand / Collapse

All times are GMT -5:00, Time now is 12:59am

2005-2007 © RightEdge Systems