Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

Tradewinds

Market Wizard
  • Content Count

    911
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Tradewinds

  1. Regular EL also has an array. I have not used the regular array. There is probably multiple ways to compare intrabar values to each other. The time could be recorded and compared. EL has something called 'intrabarpersist'. I find it confusing and a pain. Intrabarpersist variables will hold intrabar values differently than regular variables. Do you have an example of how to do this with regular easylanguage? Unfortunately I can't edit my post that you are referring to. I'd change the wording, but I can't now. I stated that there was only one way to do something, but I'm sure that isn't true.
  2. All it takes is an idea in the forefront of people's lives to create real change. Economics is nothing more than people cooperating with each other to utilize potential. It's that simple. You don't need a master's degree in economics to understand this. Utilizing potential. That's the foundation. The potential is there. Okay? We have the people, we have the resources, we have the infrastructure. So what's missing? COOPERATION. Please copy this. Send it to everyone. An idea can initiate positive change.
  3. That could be an interesting study. In order to answer the question, there would need to be a poll done, and have enough people respond in order to have the results be reliable. And there are lots of factors that could affect each person's experience. How much money did they have to begin with? What is their personality? How much time did they put in? I'd be interested to know if there are already studies and data out there that deal with people's tolerance for risk, and their ability to adapt. I wouldn't be surprised if someone has done a study on people who engage in risky behavior, like rock climbing, etc.
  4. I think it's important to suggest solutions to the problems of internet abuse and misuse. Governments will often implement solutions that could be dangerous to the citizens freedom, if that power was used inappropriately. The public can do an excellent job 'policing' things like the internet themselves, IF they have the tools available to them. I would like to see Internet Service Providers and email providers like Google, and Yahoo, provide ways to report misuse and abuse in a very easy way, and make the reports public. So if 1000 people complained about spam from a certain email address, it would be publicly available information, and could be used as proof to investigate. I don't want censorship, but I don't want SPAM either. I think the solution is to make it very easy to report misuse and abuse. Of course, it's already possible to report abuse, but I have serious doubts about how serious it's taken or what is actually done. Maybe the issue is tracking the source down. If that's the problem, then make it easier to track the source down.
  5. If you are doing internet searches, you never know what kind of a webpage is going to pop up when clicking a search link. One thing you can do is run your Web Browser in 'Sandboxed' mode. Sandbox mode restricts all the files that get written to your hard drive from the internet. There is a free Sandbox program named Sandboxie. Sandboxie
  6. Here is some object oriented code that I am using in a bigger program to check for a profit threshhold before allowing the program to take profit. It checks for both long and short profit in the current position. If the position goes flat, everything is reset. This code uses the PositionsProvider1 class object. Open the toolbox and drag PositionsProvider1 into the code editor. An icon will appear at the bottom of the code editor. var: intrabarpersist ShrtProfitOK(False), intrabarpersist LngProfitOK(False), intrabarpersist MostGain(0), intrabarpersist CrrntPL(0); Method void EnoughProfit() var: int FlatLngShrt; Begin If PositionsProvider1.Count <> Null then begin FlatLngShrt = PositionsProvider1.Position[0].Type; // Type is Flat, Long or Short CrrntPL = PositionsProvider1.Position[0].PLPerQuantity; // Profit or Loss divided by Position Qty End Else Return; // If Positions Provider is Null, then end the method here If FlatLngShrt = 0 then Begin // 0 is flat ShrtProfitOK = False; LngProfitOK = False; MostGain = 0; // Reset to zero, if you are flat CrrntPL = 0; Return; End; {Determine what the most profit this position attained is, and maintain that unless it goes to a loss} if CrrntPL > 0 and CrrntPL > MostGain then MostGain = CrrntPL Else if CrrntPL < 0 then MostGain = CrrntPL; // If the most gain this position has attained is less than the threshhold If MostGain <= 12.5 then Begin ShrtProfitOK = False; // Indicate that profit level is not OK LngProfitOK = False; End Else If FlatLngShrt = 1 and MostGain > 12.5 then // 1 is Long LngProfitOK = True Else If FlatLngShrt = -1 and MostGain > 12.5 then // -1 is Short ShrtProfitOK = True; End;
  7. I now have an indicator that incorporates all of my other indicators. It is mostly object oriented code in EasyLanguage. It will automatically exit and re-enter a trade with confirmation. A pop up comes up asking whether to send the trade or not. So if the program goes wild, it won't enter hundreds of orders a minute non-stop. It's not fully automated. It's mostly for exiting from the direction I've chosen to trade. What I like about it is that it executes very fast, and catches my conditions faster than I might be able to detect them myself. Sometimes it actually reacts to fast and chooses a worse price than I could have otherwise gotten. But I'm more likely to get filled. That indicator is now over 2000 lines long. Probably 80 percent of my effort was put into filtering out multiple orders and making sure the program would stop or abort before it went into an endless loop of entering non-stop orders. Now I want to program my own confirmation dialog that will confirm an entry, but allow an automatic exit.
  8. The color is controlled by 'Avg' being up or down since the last bar. Avg <Avg [1]. If you wanted it delayed, wouldn't you need to check multiple bars? To change color down it would need to pass this test: Avg <Avg [1] and Avg[1] < Avg [2] and Avg[2] < Avg [3] otherwise stay the same color, or display a neutral color. var: ChangeDown(False), ChangeUp(False); ChangeDown = Avg <Avg [1] and Avg[1] < Avg [2] and Avg[2] < Avg [3]; ChangeUp = Avg >Avg [1] and Avg[1] > Avg [2] and Avg[2] > Avg [3]; if ChangeDown then setplotcolor[1](1, magenta ) else if ChangeUp then setplotcolor[1](1, Green );
  9. Accept and prioritize: ACCEPT: It will take years to become a good and competent trader. ACCEPT: You need money, and the discipline to manage your personal finances for a long time before you become profitable. ACCEPT: Unless you give trading a huge part of your life, and are dedicated to it, I don't know that you can succeed. PRIORITIZE: What can you afford to give in time and money to trading, and what do you need to give to everything else? Unless you get the above things right, talking about what market to trade or what method to use might turn out to be a futile effort. You can spends months or years pursuing any of the many trading methods, only to find out that you don't believe in it. Try to get quick exposure to as many types of trading methods and theories as you can, then compare and contrast them, and assess your personal ability to utilize them. What I'm saying is, don't become obsessed with one thing to the point where you are not learning anything new. Always be asking whether the trading method has an explanation for what moves the price, and does it make sense to you.
  10. EasyLanguage now has Object Oriented Arrays. EL (EasyLanguage) calls the arrays VECTOR Arrays. Actually, EL OO has something called "Collections", which are a collection of data. There are 5 different types of Collections. The answer to the traditional Array in EL OO is a VECTOR. But a VECTOR array can access a particular element in the array. Here are the methods that can be used in a VECTOR array. This code creates two vector ARRAYs. The code inside the METHOD subroutine only runs when an order is updated. It is an Event Driven subroutine. The event is the order status changing, for example, the order goes from Sending to Sent, or Sent to Received, or from Received to Filled, or From Filled to Closed out. This Method subroutine keeps track of unfilled Buys and Sells. var: Vector UnFilledSells( NULL ), UnFilledBuys( NULL ); method void OP1_Updated( elsystem.Object sender, tsdata.trading.OrderUpdatedEventArgs args ) var: int iCount, int TheState, int QtyUnfilled, int BuyOrSell, string OrdrNum, bool ItsInThere, int SellsCount, int BuysCount; begin Once Begin // If the vector is created more than once, it deletes all the elements UnFilledSells = new Vector; // Create the new array. UnFilledBuys = new Vector; End; TheState = args.State; // Get the state of the current order if OP1.Orders.Count > 0 then QtyUnfilled = OP1[0].LeftQuantity else QtyUnfilled = 0; OrdrNum = args.OrderID; // Get the order number of the order that was just updated if StrLen(OrdrNum) > 0 then BuyOrSell = OP1[OrdrNum].Action else BuyOrSell = 0; // Buy = 1 Sell = 2 //print(file("c:\VctrArry.txt"), "Prn1 ", "array lngth=", UnFilledSells.Count:0:0, " | Order Num=", OrdrNum, " State=", TheState:0:0, " | Qty Entered=", QtyUnfilled:0:0, " | Time=", Formattime("hh:mm:ss", TradeTimeEx)); If UnFilledSells.empty() = False then // If the array is NOT empty, get the count of how many records SellsCount = UnFilledSells.Count else SellsCount = 0; // Get how many records are in the array If UnFilledBuys.empty() = False then // If the array is NOT empty, get the count of how many records BuysCount = UnFilledBuys.Count else BuysCount = 0; // Get how many records are in the array ItsInThere = False; If SellsCount > 0 and BuyOrSell = 2 then begin For iCount = 0 to UnFilledSells.Count - 1 begin // Loop through all the orders in the array If UnFilledSells.at(iCount) astype string = OrdrNum then // Check if current order number is in the array ItsInThere = True; End; End; If BuysCount > 0 and BuyOrSell = 1 then begin For iCount = 0 to UnFilledBuys.Count - 1 begin // Loop through all the orders in the array If UnFilledBuys.at(iCount) astype string = OrdrNum then // Check if current order number is in the array ItsInThere = True; end; End; // If the array is empty, just add the order If (TheState = 4 or TheState = 2) and SellsCount = 0 and BuyOrSell = 2 then begin // If it's a SELL order, and the array is empty, then add a new element to the SELL array UnFilledSells.insert(0, OrdrNum); // If state is received, sent or sending and it's not in the array, add it UnfilledSellOrdrs = UnFilledSells.Count; //print(file("c:\VctrArry.txt"), "Prn2 ", "array lngth=", UnFilledSells.Count:0:0, " | Order Num=", OrdrNum, " State=", TheState:0:0, " | Qty Entered=", QtyUnfilled:0:0, " | Time=", Formattime("hh:mm:ss", TradeTimeEx), Newline); Return; // If the order number needed to be added to the arry, then your done. Quit here. End; If (TheState = 4 or TheState = 2) and BuysCount = 0 and BuyOrSell = 1 then begin UnFilledBuys.insert(0, OrdrNum); // If state is received, sent or sending and it's not in the array, add it UnfilledBuyOrdrs = UnFilledBuys.Count; //print(file("c:\VctrArry.txt"), "Prn2 ", "array lngth=", UnFilledSells.Count:0:0, " | Order Num=", OrdrNum, " State=", TheState:0:0, " | Qty Entered=", QtyUnfilled:0:0, " | Time=", Formattime("hh:mm:ss", TradeTimeEx), Newline); Return; // If the order number needed to be added to the arry, then your done. Quit here. End; If TheState <> 4 and TheState <> 2 and BuyOrSell = 2 and ItsInThere = True then begin // If order status is anything buy sent or received For iCount = 0 to UnFilledSells.Count - 1 begin // Loop through all the orders in the array If UnFilledSells.at(iCount) astype string = OrdrNum then begin // Check if current order number is in the array ItsInThere = True; // The order number was found in the array // If the order in the vector has any status but 4, then delete the record UnFilledSells.erase(iCount); // If it's not a status of Received, then it's been filled, or canceled, etc UnfilledSellOrdrs = UnFilledSells.Count; Return; End; End; End; If TheState <> 4 and TheState <> 2 and BuyOrSell = 1 and ItsInThere = True then begin For iCount = 0 to UnFilledBuys.Count - 1 begin // Loop through all the orders in the array If UnFilledBuys.at(iCount) astype string = OrdrNum then begin // Check if current order number is in the array ItsInThere = True; // The order number was found in the array // If the order in the vector has any status but 4, then delete the record UnFilledBuys.erase(iCount); // If it's not a status of Received, then it's been filled, or canceled, etc UnfilledBuyOrdrs = UnFilledBuys.Count; Return; End; End; End; If (TheState = 4 or TheState = 2) and BuyOrSell = 2 and ItsInThere = False then begin // if the order number is not in the array UnFilledSells.insert(0, OrdrNum); // If state is received or sending and it's not in the array, add it UnfilledSellOrdrs = UnFilledSells.Count; //print(file("c:\VctrArry.txt"), "Prn4 ", "array lngth=", UnFilledSells.Count:0:0, " | Order Num=", OrdrNum, " State=", TheState:0:0, " | Qty Entered=", QtyUnfilled:0:0, " | Time=", Formattime("hh:mm:ss", TradeTimeEx), Newline); Return; // Return is not needed in a VOID method, but useful to control when the execution is stopped. End; if (TheState = 4 or TheState = 2) and BuyOrSell = 1 and ItsInThere = False then begin UnFilledBuys.insert(0, OrdrNum); // If state is received or sending and it's not in the array, add it UnfilledBuyOrdrs = UnFilledBuys.Count; //print(file("c:\VctrArry.txt"), "Prn4 ", "array lngth=", UnFilledSells.Count:0:0, " | Order Num=", OrdrNum, " State=", TheState:0:0, " | Qty Entered=", QtyUnfilled:0:0, " | Time=", Formattime("hh:mm:ss", TradeTimeEx), Newline); Return; // Return is not needed in a VOID method, but useful to control when the execution is stopped. End; End;
  11. Are you trying to 'Play it Safe' in how you trade? The market is not about being safe. The market can NOT reward anyone for safe bets. If the market starts rewarding people for safe, easy bets, then the market will cease to exist in a very short while. If everyone made money trading, then the market would cease to exits very quickly. It would be all over with in a matter of a few weeks. If everyone could easily make money in the market, then everyone would do it, and then all the money would be sucked out. It's like a gambling casino. How long do you think a gambling casino would stay in business if everyone made money? A day? A couple days? A week? It wouldn't be very long. No risk, no reward. The market is about risk. Investing is about risk. But we all come programmed to avoid risk an any cost.
  12. What does 'Trending' mean? If up trending means one higher high, then the trader needs to wait until the next higher high to believe that an uptrend has started. The next higher high means that there have been two highs. So I've already missed both those highs. If the downtrend has not ended until the uptrend has started, then do I need to wait to exit the short until the next higher high? How do you trade that situation? If I wait to exit the short until the next higher high, in a lot of situations, I could be back to breakeven or even at a loss. That doesn't make any sense to me. Explaining market behavior in terms of 'Trends' can be extremely misleading. What a trend is could mean different things to different people. And even if there was a consensus about what the definition of a trend is, it's still all meaningless unless the trader understands what usually makes price do what it does. There needs to be a positive correlation between what price does and some underlying reason. For example, price doesn't do anything because the close just crossed an MA line. Maybe if enough people THINK that price SHOULD do something because the close crossed an MA line, then something will happen. But that is because of human behavior, not the trend line. Trend lines don't make the price do anything. My point is, that we all get caught up in thinking that price is going to do something for reasons that have absolutely nothing to do with why the price is really doing what it's doing. It's meaningless to come up with trading rules unless a trader has some knowledge about what makes the price do what it does. Unless I read about the reasons for price doing what it does, and it is then proved to me, then there is no point learning the strategy rules. Why learn strategy rules and have no idea what the rules are based on? It's absolutely meaningless to talk about trends unless there is a specific definition for what a trend is. And then the strategy rules need to fit the trend definition. If a definition of a trend is that the price is going in one direction for "quite a while", then by the time you identify it as a trend, then "quite a while" has already gone by. It's a "Catch 22" situation. By the time the price has met that definition of a trend, it could be ready to start moving the other direction. So depending upon a trader's definition of a trend, and what the rules are to the strategy, you could always be late to enter.
  13. Have you looked at TradeStation?
  14. If the account has no open positions, PositionsProvider1.Position[0].Quantity will return an error during trading and shut your indicator down. Which is really stupid, but that's the way it is. But I've found a way to deal with that situation by first checking for any open positions. If PositionsProvider1.Count <> Null then Value3 = PositionsProvider1.Position[0].Quantity else value3 = 0; So, if there are no open positions, the code doesn't try to retrieve a quantity. That avoids the error msg, and sets Value3 to 0.
  15. I've had trouble with this line: QtyOpen = PositionsProvider1.Position[0].Quantity; This seems to be better at getting the current quantity of your open order: var: Ticker(" "), AccntNum(" "); Once Begin // Run once per load AccntNum = GetaccountID(); Ticker = Getsymbolname; End; QtyOpen = GetPositionQuantity(Ticker, AccntNum);
  16. Good explanation. The part about "Human.Walk" makes sense to me. The category 'Human' is to broad, and not specific to one 'instance'. The only way that "Human.Walk" would work, is if it forced all humans on the entire planet to walk. But that wouldn't be very beneficial. It would be like giving the order, All_TL_Members.Post That would be a nightmare. LOL It's better to use: MMS.Post Then we can make some progress. :rofl: tsdata.trading.Order.Cancel would need to cancel every single order. There could be OrderOne, OrderTwo, OrderFutures, OrderStocks, etc. There might be times when you might want to cancel all orders, but you would want a specific command for that. It's important to be able to control one specific instance of something, so there needs to be a way to label and refer to that specific instance.
  17. Yes, thank you for that. Personally, I would rather execute trades intrabar instead of waiting for the next bar for a strategy to send the order. I'm wondering if there might be some way to get the data needed to determine the profitability even without the backtesting. I'll probably be looking into the subsecond issue at some point. It seems that I've seen functions for millisecond timers.
  18. Here is some code that should exit a current long order. var: tsdata.trading.order OrdrInfo(Null); var: xLng(False), xShrt(False), QtyOpen(0); {If there is a signal to exit a long position or exit a short position, first get the Quantity of orders currently open. Don't need to get the qty open unless there is a reason to exit, so make it conditional. For this code to work, the OrderTicket1 and PositionsProvider1 must be dragged from the toolbox into the code editor.} If xLng or xShrt then QtyOpen = PositionsProvider1.Position[0].Quantity; // if there is a signal to exit a long, // and no other order has been placed this bar, // and the Qty open is greater than 0, then close the long. If xLng and xLngFired = False and QtyOpen > 0 then begin xLngFired = True; // Immediately set the xLngFired variable to true OrderTicket1.SymbolType = 0; // Set security type to Future OrderTicket1.Symbol = "Symbol"; // Set symbol for order to current symbol on chart OrderTicket1.Quantity = QtyOpen; // Set order qty to the qty of orders open to exit the position OrderTicket1.Action = 2; // Set the order to a SELL order OrderTicket1.Type = 2; // Set order type to Market OrdrInfo = OrderTicket1.Send(); // Send the order End; // At end of the bar reset the status of whether an order was sent on this bar or // not back to False If Barstatus(1) = 2 then begin xLngFired = False; xShrtFired = False; End;
  19. In the Help info, it defines the Price Scale as the precision to which a security trades. So even it the tick size is 0.05, it's still trading at a 0.01 precision. I would leave it at 1/100. I think that the tick size is something different. Look under the 'Scaling' tab of the Format Symbol box. That allows you to set the tick size. There is a 'Custom Axis Increment'. If the tick size is 0.05, then set the 'Custom Axis Increment' to 0.05. The data coming in will probably be automatically formatted to the correct tick size. If whatever the symbol is, trades in a tick size of 0.05, I don't see how or why you would get data coming in at 1 cent increments. You just need the price axis to be displaying increments that make it easy to determine what the current price is.
  20. I do know that once the variable has been defined in that way, with 'tsdata.trading.Order' as the type of data, that the variable 'MyOrder' has options available to it. I can not use: tsdata.trading.Order.Cancel But I CAN do this: MyOrder.Cancel I don't know why those two are not interchangeable.
  21. I guess that Events allow objects to send and receive information. A property is easy to understand. The button is blue. The Order Qty is 1. Methods cause some action. Send the Order. Properties Methods Events Events don't cause an action, but you use an Event if you want to get information, or send information about an object?
  22. Let's look that the last part of the code: {Send the order when TRUE and sets the method used to handle Order Status Updated events} If PlaceOrderNow then begin {Order sent only once per load in this example} once MyOrder = OrderTicket1.Send(); MyOrder.Updated += OrderStatusUpdate; UpdatePlots(); end; 'MyOrder' is a variable. I'm familiar enough with EasyLanguage to know that certain commands return an output value, and it's required to set a variable equal to the command in order to receive the output value. So the variable, 'MyOrder' is set equal to the OrderTicket1.Send() Method. This places the order. Then on the next line, the variable 'MyOrder' has something appended to it. MyOrder.Updated I use the autocomplete, and went through the list of things available to 'MyOrder', and 'Updated' has a lightening bolt icon in front of it. I don't know what that icon stands for. There are different icons that mean different things. Okay, I just found it, the lightening bolt means that it's an Event. The Help states that 'Updated' is an Event Handler that is called whenever the object is updated. The Event Handler is called, but what does that do? I really don't know what the end result of 'MyOrder.Updated' is? Now, I don't know what the plus and equal signs do in the line: MyOrder.Updated += OrderStatusUpdate; The OrderStatusUpdate is the subroutine name. So that makes the subroutine run. I don't know why the plus and equals signs are there?
  23. Okay, so when the status of an order changes, the platform updates and maintains the info about the order change in a database. Information on the order status can be retrieved and sent to the 'Event Handler' when something detects the 'OrderStatusUpdate' event? Are there some basic rules about the 'sender' and 'receiver'? I'm assuming that the 'sender' was whatever called the event handler? And the receiver is the event handler?
  24. Let's move on to the next section: {Called whenever the order status is updated} Method void OrderStatusUpdate(elsystem.Object sender, tsdata.trading.OrderUpdatedEventArgs args) begin UpdatePlots(); end; The above section of code is a subroutine. Don't confuse the Method reserved word with Object Oriented Methods. These are two different things. The above subroutine is named 'OrderStatusUpdate'. The 'OrderStatusUpdate' subroutine runs whenever it is called with the 'OrderStatusUpdate' name. Subroutines created with the Method reserved word can receive arguments passed to it. In this indicator, the call to the subroutine comes later down in the code than the subroutine. Method Subroutines can be called from a line either below or above the subroutine. A sequential programing flow is not required. It looks like the 'OrderStatusUpdate' subroutine is set up to receive a couple input arguments. The first argument is: elsystem.Object sender elsystem.Object is as follows: 'sender' and 'args' are the names given to the input parameters. elsystem.Object is the data type of the input 'sender'. The data type must be put in front of each input parameter name. Okay, 'sender' and 'args' are just named parameters. Sort of like naming variables, but here, the inputs are named. So the Method subroutine will receive data of data types, elsystem.Object and tsdata.trading.OrderUpdatedEventArgs, and those data type names are 'sender' and 'args'. So this subroutine named 'OrderStatusUpdate' will receive inputs, and then this subroutine calls another subroutine named 'UpdatePlots'. I don't know what the point is of the subroutine 'OrderStatusUpdate' receiving inputs. I don't see that those inputs are used in any way, unless they are then passed on again to the 'UpdatePlots' subroutine. But I don't know if that's what happens or not.
  25. Here is an even longer list of Order Status States that can be checked with OO. I'm quite sure that none of this is available through reserved words. In other words, if you want to be able to have you code check for these conditions, you'll need to use OO. I have no idea what a "BigBrotherRecall" is. Namespace: tsdata.trading Enumerated Values Name Value BigBrotherRecall 34 BigBrotherRecallRequest 33 BracketCancelled 28 BracketFilled 29 Broken 1 Canceled 2 CancelRequestRejected 20 CancelSent 16 Change 3 ChangeRequestRejected 23 ConditionMet 26 Dead 5 Dispatch 4 ExpirationCancelRequest 30 Expired 6 FillCorrected 17 Filled 7 OptionAssignment 27 OptionExcercise 31 OrderStatusMessage 14 OSOOrder 32 PartialFillAlive 9 PartialFillUROut 8 Queued 22 Received 0 Rejected 13 Replaced 15 ReplaceSent 25 Sending 19 Sent 11 StopHit 24 TooLateToCancel 10 TradeServerCanceled 18 UnSent 21 UROut 12
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.