Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Class member declaration expected

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Class member declaration expected

    I have written a method I would like to use it in my Strategy but get the error "Class member declaration expected" when I add it to my code. I am putting it in the Properties section, is this incorrect?

    Thanks, here is the method:-

    Code:
    private void orderManage(iOrder order, private double b, private double a, private int bv, private int av)
    		{
    			b = GetCurrentBid();
    			a = GetCurrentAsk();
    			bv = GetCurrentBidVolume();
    			av = GetCurrentAskVolume();
    			
    			if(order != null && order.OrderAction == OrderAction.Buy)
    			{
    				if(order.LimitPrice + 1*TickSize == a && av < 10)
    				{
    					order = EnterLongLimit(tBIP,true, 1, GetCurrentAsk(tBIP), "Long");
    				}
    				else if(order.LimitPrice + 1*TickSize == a && av < 50 && av < bv)
    				{
    					order = EnterLongLimit(tBIP,true, 1, GetCurrentAsk(tBIP), "Long");
    				}	
    			}
    			
    			if(order != null && order.OrderAction == OrderAction.Sell)
    			{
    				if(order.LimitPrice - 1*TickSize == b && bv < 10)
    				{
    					order = EnterShortLimit(tBIP,true, 1,GetCurrentBid(tBIP), "Short");
    				}
    				else if(order.LimitPrice + 1*TickSize == a && av < 50 && av < bv)
    				{
    					order = EnterShortLimit(tBIP,true, 1,GetCurrentBid(tBIP), "Short");
    				}
    			}
    		}

    #2
    Hello,

    Thank you for the question.

    It looks like there are a few errors in your overload parameters on this method, first would be the use of the lowercase i in IOrder. The I needs to be capital and also the O to make IOrder.

    Also the use of private in your overload is not needed and will cause errors. When you declare a new private method you do not need to include private on each variable. Instead you just need the naming convention of Type followed by a variable name or (double testVar) for example.

    Here is what you had with the parts that need to be changed in bold.

    Code:
     private void orderManage([B]iOrder [/B]order, [B]private [/B]double b, [B]private [/B]double a, [B]private [/B][B][I]int [/I][/B]bv, [B]private [/B][B][I]int [/I][/B]av)
    What would need to be changed in order to be correct:

    Code:
    private void orderManage(IOrder order, double b, double a, long bv, long av)
    Additionally you have bv and av as type int when they need to be a type of double.

    After making these changes the script should compile correctly.

    here is the modified code:


    Code:
    private void orderManage(IOrder order, double b, double a, long bv, long av)
    		{
    			b = GetCurrentBid();
    			a = GetCurrentAsk();
    			bv = GetCurrentBidVolume();
    			av = GetCurrentAskVolume();
    			
    			if(order != null && order.OrderAction == OrderAction.Buy)
    			{
    				if(order.LimitPrice + 1*TickSize == a && av < 10)
    				{
    					order = EnterLongLimit(tBIP,true, 1, GetCurrentAsk(tBIP), "Long");
    				}
    				else if(order.LimitPrice + 1*TickSize == a && av < 50 && av < bv)
    				{
    					order = EnterLongLimit(tBIP,true, 1, GetCurrentAsk(tBIP), "Long");
    				}	
    			}
    			
    			if(order != null && order.OrderAction == OrderAction.Sell)
    			{
    				if(order.LimitPrice - 1*TickSize == b && bv < 10)
    				{
    					order = EnterShortLimit(tBIP,true, 1,GetCurrentBid(tBIP), "Short");
    				}
    				else if(order.LimitPrice + 1*TickSize == a && av < 50 && av < bv)
    				{
    					order = EnterShortLimit(tBIP,true, 1,GetCurrentBid(tBIP), "Short");
    				}
    			}
    		}
    Please let me know if I may be of additional assistance.
    Last edited by NinjaTrader_Jesse; 01-16-2015, 09:31 AM.

    Comment


      #3
      Hi Jesse thx.

      dv and av need to be doubles? I am setting them to volume of bid and ask.

      Comment


        #4
        Hello,

        Thank you for catching that, These are actually Long type not Double, they can be cast as a double because a double is simply a floating point number in which a long type could be converted into, so the compiler did not catch that.

        To be correct these are listed as a long in the help guide, I will modify my post to reflect this.



        If we look at the Method Return Value it lists:
        A long value representing the current ask volume

        Please let me know if I may be of additional assistance.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        669 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        378 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        111 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        580 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X