Help with quotOrderSend error 4051quot - Page 2
Page 2 of 502 FirstFirst 12
Results 11 to 13 of 13

Thread: Help with quotOrderSend error 4051quot

  1. #11
    Quote Originally Posted by ;
    Hi. Im not getting anymore of the errors and I got it to track the bid/ask after attaining the beginning point (BEPoint) since you place it. I really do have a query about your code however. The component that calls the Trailing_Control is only activated once per bar? Which means the Stoploss will simply be upgraded once per bar?
    Ernie11-

    Yes you're correct. You can eliminate the condition in case you want but it will then check on every tick.

    You are also correct that there is no additional monitoring included. Your post wasn't clear as to what you wanted to do following the initial trailing stop.

  2. #12
    cyber1. Ok thank you. I hadn't ever thought about upgrading once per, neat idea. I love to code as much as possible myself but once I get stuck I ask for assistance on that part only and continue going.
    Whatever else you think I should add to aid with the money management part you can consider?
    Thank you again.

  3. #13
    Hello everyone. Ive been trying to figure this out for some time now but havnt been able to. Some help with this would be fine. The code below is what implements my long transactions but I keep receiving OrderSend mistake 4051 invalid lots sum for OrderSend function. Ive tried different methods but nothing seems to work. By using this code within my lot dimensions im trying to get a lot dimensions that is only going to risk my percentage per trade but using a variable stoploss in reference. The stoploss varies from trade to trade since its the lowest low in 50 candle back. If you know of a simpler or better way that would also be valued.

    Edit:'m seeking to incorporate risk/money management into my transactions using this method.

    Variables Code:
    Inserted Code extern int Risk_Percent = 3; //Percent of the account to risk per trade. Dual LowestShift = iLowest(Symbol(), PERIOD_H1, MODE_LOW, 50, 1); //Find the candle using the lowest non in 50 candles back. Double Lowest = iLow(Symbol(), PERIOD_H1, LowestShift); //Find the low of the candle utilized by LowestShift double Buy_Take_Profit = ((Bid-Lowest) Ask); //To make the trade 1:1
    Execution Code:
    Inserted Code if (Condition1 gt; Condition2) if (Condition3 lt; Condition4) if (Condition5 lt; Bid) if (getOpenOrders() == 0) double Buy_Lots = NormalizeDouble(((AccountBalance()*(Risk_Percent/100))/(((Bid-Lowest)*100000)*(MarketInfo(Symbol(),MODE_TICKVALU E)))),2); Buy_Order = OrderSend(Symbol(),OP_BUY,Buy_Lots,Ask,30,Lowest,B uy_Take_Profit,NULL,2000,0,clrGreen);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners more information