NexusFi: Find Your Edge


Home Menu

 





a question about my first Indicator programmed in MultiCharts.Net


Discussion in MultiCharts

Updated
    1. trending_up 1,734 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 5 posts
    2. attach_file 4 attachments




 
Search this Thread
  #1 (permalink)
 gztanwei 
toronto
 
Experience: Beginner
Platform: NinjaTrader
Posts: 33 since Sep 2009
Thanks Given: 3
Thanks Received: 11

I am trying out MC.Net from AMP, but it turned out that I have to be paid user to post on MC.Net's official discussion forum. So I hope that I can get help in nexusfi.com (formerly BMT) instead.

I programmed my first really simple indicator CurrectionBar modeling off C_Hammer_HangingMan.Function and .Indicator

But when I ran it, I got this error message. I checked 10+ times on what is different between my indicator and the C_Hammer_HangingMan but got no luck. Could you please help to check it out what I did wrong?


Attached Files
Elite Membership required to download: CurrectionBar.zip
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Brendt Skorupinsky
Trading Reviews and Vendors
How to plot a custom icon for crossover
NinjaTrader
Pivot Indicator based on Level2 data
NinjaTrader
MC PL editor upgrade
MultiCharts
MC Advanced Simulated Trading.
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
ApexTraderFunding.com experience and review
134 thanks
1 Minute Man
60 thanks
HumbleTraders next chapter
43 thanks
Winning attitudes create winning traders
36 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
25 thanks
  #2 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


gztanwei View Post
But when I ran it, I got this error message. I checked 10+ times on what is different between my indicator and the C_Hammer_HangingMan but got no luck. Could you please help to check it out what I did wrong?

That's normally not a very hard error message to solve. Can you post your code in a .txt file? I'm not a big fan of importing .pln files with unseen code.

Reply With Quote
  #3 (permalink)
 gztanwei 
toronto
 
Experience: Beginner
Platform: NinjaTrader
Posts: 33 since Sep 2009
Thanks Given: 3
Thanks Received: 11



Jura View Post
That's normally not a very hard error message to solve. Can you post your code in a .txt file? I'm not a big fan of importing .pln files with unseen code.

Thanks for the reply.

I found the reason now. It is because in C_Hammer_HangingMan.Function.CS, for some unknown and strange reason, it declares the two output objects, but do not initialize them.



and it depends on the C_Hammer_HangingMan.Indicator.CS to pass in an empty object.

Do you happen to know what is the good on handling this way? to me it is much simpler to declare this way:

 
Code
        private VariableSeries<double> m_ohammer;
        public ISeries<double> ohammer{
        get { return m_ohammer; }
	    }



and below is my whole function of correction bar:

 
Code
using System;

namespace PowerLanguage.Function
{
    public class C_CorrectionBar_Up_Down : FunctionSeries<Double>
    {
//Declare variables
        private VariableSeries<double> m_oCB_Up;
        public ISeries<double> CB_Up{
        get { return m_oCB_Up; }
	    }	
        private VariableSeries<double> m_oCB_Down;
        public ISeries<double> CB_Down{
        get { return m_oCB_Down; }
	    }	
//Declare structurer
		public C_CorrectionBar_Up_Down(CStudyControl ctx) :
            base(ctx) {}

        public C_CorrectionBar_Up_Down(CStudyControl ctx, int data_stream) :
            base(ctx, data_stream) {}

//create function, which initiatializes classes needed for the class
        protected override void Create(){
			m_oCB_Up = new VariableSeries<Double>(this);
			m_oCB_Down = new VariableSeries<Double>(this);
        }

        protected override void StartCalc(){
            
        }


        protected override double CalcBar(){
            m_oCB_Up.Value = 0;
            m_oCB_Down.Value = 0;
            if (Bars.CurrentBar > 2){
                if (Bars.High[1]>Bars.High[0])
                {
                    m_oCB_Up.Value = 1;
                }
            else{
                if (Bars.Low[1]<Bars.Low[0])
                {
                    m_oCB_Down.Value = 1;
                }
                }
            }
            return 1;
        }
    }
}

Started this thread Reply With Quote
  #4 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


gztanwei View Post
Do you happen to know what is the good on handling this way? to me it is much simpler to declare this way:

I always use an automatic property in Visual Studio since that's easier to code (with the `prop` code snippet) and is the same as MultiCharts uses in their programming manual.

I don't know if this is the 'good' or 'best' way, I don't think it matters that much as long as both compile and are recognised by MultiCharts .NET as an input.

Reply With Quote
  #5 (permalink)
 gztanwei 
toronto
 
Experience: Beginner
Platform: NinjaTrader
Posts: 33 since Sep 2009
Thanks Given: 3
Thanks Received: 11


Jura View Post
I always use an automatic property in Visual Studio since that's easier to code (with the `prop` code snippet) and is the same as MultiCharts uses in their programming manual.

I don't know if this is the 'good' or 'best' way, I don't think it matters that much as long as both compile and are recognised by MultiCharts .NET as an input.

Thanks for the reply.

Speaking of Visual Studio, I do like VS better, but I found that the solution only includes indicators and signals; it does not include functions classes. Such as ADX, ADX.Function.cs is not in the solution.

Do you have "hacks" around it?


Started this thread Reply With Quote
  #6 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 690


gztanwei View Post
Speaking of Visual Studio, I do like VS better, but I found that the solution only includes indicators and signals; it does not include functions classes. Such as ADX, ADX.Function.cs is not in the solution.

Do you have "hacks" around it?

It would be nice if there were 'hacks' around, but I don't know of any. What I do know is that functions are built-in the PowerLanguage .NET Editor (see MultiCharts: Trading Software for Automated Trading and [AUTOLINK]Backtesting[/AUTOLINK] ? View topic - [AUTOLINK]MultiCharts[/AUTOLINK] .NET FAQ), so I don't expect them to be available in the VS anytime.

Reply With Quote




Last Updated on August 31, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts