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

Posts posted by Tradewinds


  1. Determining the Quantity Open is important to be able to close a position from code. You need to designate how many of the position to close.

     

    If HigherHigh and QtyOpen > 0 then begin
    value1 = MarketOrder("OncePerBar", GetAccountID(), "Sell", "Future", GetSymbolName, QtyOpen);
    Condition1 = (PlaySound("c:\Wave\CloseLong.wav"));
    End;


  2. There is a way to retrieve the quantity and side of the position open. The symbol must be designated, as you could have multiple positions open with different ticker symbols.

     

    GetPositionQuantity(GetSymbolName, GetAccountID)

     

    Short Positions are designated by a negative number. This code displays the quantity open on the chart.

     

    var: QtyOpen(0);
    
    Once 
    begin  
    Value1 = Text_new( D, T, H, "x");
    end;
    
    QtyOpen = GetPositionQuantity(GetSymbolName, GetAccountID);
    
    Text_SetString(Value1, "       Positions: " + NumToStr(QtyOpen,0));
    Text_SetLocation(Value1, D, T, H + 0.02 );
    Text_setcolor(Value1, Black);


  3. There are programing options available through macro commands that you may not know about, or be able to find unless you had done a lot of digging through the help documentation. If you do a search or an index search on the word "order", you will not find the Macro Commands available to Command Line Macros. But there are over 150 commands available to Command Line Macros, including the .PlaceOrder macro command.

     

    To find the list of Command Line macro commands, go to the platform help and enter "Command Line Reference" in the Index search. If you go to the "EasyLanguage Reserved Words & Functions" help through the Easy Language code editor you will NOT find anything about these macro commands. There is a difference between the EasyLanguage Reserved Words & Functions help, and the Platform help, and they do NOT reference each other.

     

    Command Line Macros can then be run with the "RunCommandOnLastBar (Function)"

     

    There may be a reason why information on these macro commands is hard to find. Commands like the ".PlaceOrder" command might get you into trouble if you didn't use it correctly. But for anyone looking for capabilities of controlling the platform through code, the macro commands provide the potential.


  4. EasyLanguage has some built in functions that use the PlaceOrder command:

     

    LimitIfTouchedOrder

    MarketIfTouchedOrder

    MarketOrder

    StopLimitOrder

    StopMarketOrder

    TrailingStopOrder

     

    LimitOrder(Frequency,Account,Action,SymbolCategory,Symbol,Quantity,Duration,GTDDate,LimitPrice)

    MarketIfTouchedOrder(Frequency,Account,Action,SymbolCategory,Symbol,Quantity,Duration,GTDDate,IfTouched)

     

    'IfTouched' = Sets the IfTouched price to be used for this order.


  5. .PlaceOrder <p...> Allows orders to be placed from macros or EasyLanguage using the provided parameters.

     

    The Place Order command allows orders to be sent to the market inside of an indicator. There is no backtesting capability for this function though. It allows orders to be placed intrabar, as opposed to "Next Bar" which a strategy does. One issue is that orders could be placed on EVERY TICK of the bar if the conditions are met. So you MUST be very careful, and make sure that your code has some way of limiting true conditions to once per bar, or as needed.

     

    .PlaceOrder <p...> Allows orders to be placed from macros or EasyLanguage using the provided parameters.

     

    TradeStation Help

     

     

    .PlaceOrder Command

     

    Places an order using a macro command or with RunCommandOnLastBar from EasyLanguage.

     

    Syntax:

     

    .PlaceOrder "< parameter='keyword' >, < parameter=number >... ,< parameter='string' > "

     

    Parameter Options

     

    A value shown below in italics represents a user specified character string, number, or macro name. All non-italic character values are keywords (i.e. Buy, False, Day+, etc). In addition, it is required that character strings, macro names, and keyword values be enclosed in single quotes.

     

    Advanced Parameters

     

    The .PlaceOrder parameters have been expanded as of TradeStation 8.5. See .PlaceOrder Advanced Parameters for more details.

     

    Parameter

     

    Value (Italicized string values are used with 'single quotes')

     

     

    account> String

    action> Buy, Sell, SellShort, BuyToCover, BuyToOpen, SellToOpen, SellToClose, BuyToClose

    ActivationPrices> String

    AllOrNone> True, False

    BuyMinusSellPlus> True, False

    Discretionary> Number, 0 {represents False}

    Duration> Day, Day+, GTC, GTC+, GTD, GTD+, IOC, FOK, OPG, CLO, 1 Min, 3 Min, 5 Min

    ECNSweep> True, False

    GTDDate> String ('MM/DD/YY' date format)

    IfTouched> Number, 0 {represents False}

    LimitPrice> Number

    MustBeUnique> True, False

    NonDisplay> True, False

    OCOBracketName> String

    OCOGroupName> String

    OrderEntryMacro> Order Entry Macro Name

    OrderName> String {limited to 20 characters}

    OrderType> Market, Limit, Stop Market, Stop Limit

    OSOTriggerBy> String {Reference the OrderName of an existing open order}

    Peg> True, False

    Quantity> Number

    QuantityType> Shares, Currency

    Route> Intelligent, AMEX, ARCX, AUTO, BATS, BTRD, CDRG, SuperDOT, EDGA, EDGX, GFLO, NITE, NQBX, NSDQ, NYSE

     

    See Order Routes for Equities or Order Routes for Options for details.

     

    ShowOnly> Number, 0 {represents False}

    Stage> True, False

    StartTime> String {hh:mm:ss AM/PM}

    StopPrice> Number

    Symbol> String

    SymbolCategory> Equity, Future, Forex, EquityOption, IndexOption

    TrailingAmount> Number, 0 {represents False}

    TrailingType> pts, pct, minmove

     

    Example:

     

    Calling from a Command Line Macro:

     

    .PlaceOrder "Action='Buy', Symbol='MSFT', SymbolCategory='Equity', OrderType='Limit', LimitPrice=25.00, Quantity=500, Duration='Day', Account='12345' "

     

    Calling from EasyLanguage:

     

    An example of using the .PlaceOrder command may be found in the EasyLanguage PlaceOrder (Function) found in the TradeStation EasyLanguage Reserved Words & Functions. Order specific functions using the PlaceOrder function are also in the EasyLanguage dictionary and make the use of the .PlaceOrder command call.

     

    For example, the following order specific function call executes the same order as the .PlaceOrder command line macro above. Extra parameters in the function place the order just once for a Day duration.

     

    Value1 = LimitOrder("Once","12345","Buy","Equity","MSFT",100,"Day","",25.00);

     

     

    It is required that character strings, macro names, and keyword values be enclosed in single quotes.


  6. This is an interesting interview with a very successful hedge fund manager. The interview was done on the Charlie Rose show:

     

    Ray Dalio on Charlie Rose

     

    Ray_Dalio - Wikipedia

     

    New Yorker - How Ray Dalio built the richest and strangest hedge fund

     

    90 Billion under management, 40% return in 2010

     

    Barrons

     

    His firm runs on a set of 295 principles that Mr. Dalio devised and distributed to all employees. The 83-page treatise, which draws lessons from the natural world, advises employees on how to achieve fulfillment at work and in life. MICHAEL CORKERY, WSJ

     

    Wall Street Journal


  7.  

    I think I'd need something like a "lastentryprice" word in order to accomplish the code...

     

    something like:

    If marketposition = 0 and ConditionLong Then Buy next bar At High + 1 point stop;
    If marketposition > 0 and Close >= [color="Red"]lastentryprice[/color] + X then buy next bar at High points stop;

     

    This is from the Easy Language help:

     

    Returns the entry price for the specified position.

     

    EntryPrice(Num)

     

    Where Num is a numeric expression representing the number of positions ago (up to a maximum of ten).

     

    Remarks

    This function can only be used in the evaluation of strategies. It does not require an input, however, by using the input Num, you can obtain the specified value from a previous position, up to ten positions ago.

     

    Example

    EntryPrice(2) might return a value of 101.19 as the entry price of 2 positions ago on a chart of Microsoft stock.

     

    Are you entering a number for how many entry orders back the entry was? You need to use the syntax:

     

    EntryPrice(1)


  8. Just took Class 1 and found it very helpful. It's the kind of experience that defined for me what I sort of knew, but I never really consciously dealt with. My major fear in trading, and in life, is the fear of making a mistake. It comes with being a perfectionist. It's something that I "know", but have never really brought to the forefront of my consciousness. It's very difficult to deal with a problem that never really gets named. The problem needs to be first defined. So that's one thing I got out of the class.

     

    But the most important thing that I believe the Class offers is a way to train my mind to develop a parallel mindset that can be used to deal with the automatic thoughts that sabotage the ability to think clearly under stress.

     

    The class provides a structure and the process that I can use to practice a new way of thinking. You learn ABC's by reciting them over and over. Now I can practice visualizing myself being successful at trading.


  9. 10-Computer.

    I have $3,500 set aside for a top-of-the-line iMac

     

    Thinkorswim created their platform to be native to Macs. I don't know if they are the only broker that has done this, but I wouldn't be surprised if they are. If you aren't doing any major programing, then their free platform and no monthly fees might be a good option for you. They have gotten many good reviews, and their charting is considered to be some of the best in the business. They are heavily weighted towards options trading, but are constantly improving their overall market scope.


  10. a goal of roughly 500% ROI, at least.

     

    I'm not against goals. Goals help keep a person motivated and moving in the right direction. But I think the goal should always be to trade well, and let the numbers speak for themselves. Once you set a goal in numbers, then you automatically set a potential trap for yourself. What if you don't hit the numbers? What does that do to your state of mind? Is it a "Set Up" for feeling disappointed? Once you are disappointed, then a downward spiral can occur. The negative emotions set in, then that leads to trading mistakes, which leads to even worse numbers. The market doesn't owe you 500% ROI. It owes you nothing. If you traded well, and took whatever the market was willing to give you, then you did outstanding regardless of what the numbers are.


  11. 3-Timeframe and method.

    I would very much like to become an adept bear trader, as I can always see a bear market coming, but I suck at shorting. It's the timing of it that I can't seem to nail down.

     

    Wanting something involves emotions. Emotions may influence your decision. It's important to determine what the best influences on your trading decisions are.

     

    Going long or going short should not be perceived as somehow different, except for the direction of the price. Is there a fundamental difference between going long or going short? Other than the psychological or emotional perspective? Price goes up, price goes down. The only difference is the direction.

     

    I don't think that you should want to become a bear trader. I think you should want to develop a perspective, and a personal discipline that sees the facts for what they are. I think you should try to see going short as really no different that going long.

     

    I'm not discounting emotions, or possible benefits of emotions. But within the context of trading, you need to somehow be able to avoid the negative emotions. Don't confuse intuition with emotion. There may be the temptation to throw out emotion, and discard intuition at the same time. Intuition is a "feel" for what is going to happen, without a conscious ability to explain yourself. If you do well trading with intuition, that's fine.


  12. Hi all guys :)

     

    I started studying EasyLanguage not long ago and I'm still a newbie.

     

    I need a little help about a part of code of the TS I'm developing.

     

    I want the TS to open a position at the "ConditionLong" signal, and, once the first position have been opened, I want it to open other positions of the same size and in the same direction every "X" points.

     

    I tried to code it but the TS only opens the first position but not the others...

    here is the code:

     

    If marketposition = 0 and ConditionLong Then Buy next bar At High + 1 point stop;
    If marketposition > 0 then buy next bar at entryprice + X points stop;

     

    Thank you in advance for your help ;)

     

    Maybe if you tried something like this:

     

    If marketposition = 0 and ConditionLong Then Buy next bar At High + 1 point stop;
    If marketposition > 0 and Close >= entryprice + X then buy next bar at High points stop;


  13. I notice that nobody wants to stick there neck out and comment on the strategy - same with ET. Don't understand why....

     

    I'm looking at what I consider to be something similar to what you are describing. But I think I'm looking at a different side of the cube. (As opposed to the other side of the coin. Which implies something two dimensional.) ;)

     

    Personally, I think what you are doing is worth investigating. You have stated that you have found a way to know when there is a price pause. So you are capturing and analyzing intrabar price behavior. I'm doing something very similar, but I'm focusing on the price surge rather than the price pause, which, in a sense might be kind of the same as what you are doing. Maybe just the other side of the coin. Or a different side of the cube. :rofl:

     

    Probably no one is commenting, because it's not a well known or widely used practice. I feel that those price pauses and price surges are a critical part to understanding price behavior. The objective is to find out how the market behaves and take advantage of it.


  14. How do you calculate wavelength for a stock ?

     

    wavelenght is (velocity/frequency) = wavelength, but this can be highly consfusing because the way to calculate frequency is basically the same as velocity.

     

    Lets say $19.95/78 Days = 0.255 Frequency Rate

     

    The problem is velocity is also measure this way which is percent or price difference divided by time.

     

    Velocity is the Rate of Change in a certain direction. E.g. $19.95 - $19.78 = $0.17 cent change. So 17 cents would be the change, and it is positive. Speed is something different. Speed is the Rate of Change for a specific unit of time. So I would call your example:

     

    $19.95/78 Days = 0.255

     

    Speed. I wouldn't call it velocity.

     

    Frequency is how many times a certain occurrence happens per a unit of time. But with trading what is the occurrence going to be? If the occurrence is every time the price hits $19.95, then it might hit that number again, or it may never hit that number again. You could define the occurrence as every time price moves 2 standard deviations of the maximum average price move over the last week. (I have no idea if that suggestion I just made is legitimate or not, I'm just throwing a suggestion out there.) My point is, find an occurrence that happens very, very regularly that you can count on. Then you could also check for outlying data that is not within the normal operating range.

     

    Once you decide on the occurrence you want to check for, and figure out a way to calculate it, then you can calculate the frequency. So write a program that counts how many times there is a price move greater than or equal to 10 cents over the last 30 minutes. That is your frequency.

     

    So before you can calculate the wavelength, I'd think that you would need to first determine what occurrence you are going to be checking for frequency. Then calculate the frequency, then plug in the velocity.


  15. I think it's important to consider what motivates people. People are motivated by the ability to make their lives better. Unless progress is being made, then people give up hope and become unmotivated. In the U.S. and other open society's, people are motivated by the freedom to pursue their personal goals. And people are motivated by the potential to make profit. If a government limits the citizens ability to pursue their personal goals, and makes it very difficult to make a profit, then motivation declines. As motivation declines, productivity, innovation and profitability plummet.

     

    But ironically, even though the U.S. is a free and open society, and people are free to pursue profit, the economy is in decline. Some is wrong here. There must be some other factors involved. So what is missing? What does an economy need to work well?

     

    • Educated people - Check, we have that.
    • A good enough infrastructure - Check, we have that.
    • Natural Resources - Check, we have that.
    • People willing to take risk, hoping for a reward, - There will always be people for that.
    • People willing to work to get a paycheck - Yes, we have that.

     

    Just like in a sports game, all the teams need to play by the same rules, and there needs to be officials penalizing people for breaking the rules. This is where the problem comes in. The game is profit, but each nation is playing by it's own rules. It's like playing a baseball game with other team, and you only have 3 strikes at bat, but they get 10 strikes before being called out. It's a lot more difficult to win the game playing by those rules. So how do the rules get manipulated? Currency exchange rates, that's how.

     

    But the protestors may not know or care about the economics involved in the problem with the declining middle class, or how personal behavior and motivation is tied to a particular governmental system.


  16. I would be a little more inclined to look favorably on the protestors if they moved their operation 230 miles down the road to Washington, D.C. where the real genesis of the bubble and subsequent burst occurred.

     

    I've always seen a huge downside to protesting. The protests can get people's attention, and create a movement, but it should be possible to get people's attention and create a movement without the protest. It should be possible, . . . . maybe it isn't?

     

    So what's the answer? How does the general population get the government motivated to make good changes?


  17. I read something like this a few of days ago.

     

    Cloud over city as elite flee debt - The Standard

     

    And this is just one town out of the thousands there.

     

     

    From that article, and what little exposure I've had to things that go on in China, I get the impression that there is a subculture of a "Gold Rush", "Lawless", "Wild West" mentality of many people in China trying to get rich through manufacturing cheap goods, and all sorts of business ventures. The article speaks of people who borrowed large at huge interest rates, and then of people committing suicide and leaving town quickly. The implication is, that the normal failure rates that apply to any new venture are starting to "kick in", and business ventures are collapsing in China.

     

    Interestingly, it probably never crossed my mind that business failures would affect China. With all the hype about China's GDP, and growth and success, I just blindly thought of China as an incredible success story without giving it a second thought.


  18. Tradewinds thanks for your replay,

    when do we intrabar don't we get the same results?

    Could you explain more please?

     

    The typical thing that everyone does, is look at the chart, then make a trading decision. I use a trading ladder, and found that I often do well paying attention to what the price is doing on the trading ladder. On the trading ladder, there is no aggregation period, and there is no time frame, there is just price doing what it does. So in a sense, the pure price action is not being fit into some kind of artificial constraint. Those artificial constraints are either a block of time, a block of volume, or some other measurement. The price data is being aggregated into blocks of data. Each bar on a chart is data constrained to some "container". And even though grouping sections of trades into blocks of data can be helpful, it also can be misleading.

     

    I often had difficulty reconciling pure price action, (with no framework or boundaries) to the way I perceived price data behavior on a chart. I've come to believe that my perception of what price is really doing is being unduly biased by how I perceive the price bars. For example, a long red candle with a close down. It's red, the close is down, so I think in terms of price going down. But price could have been going up at the end of the bar. In fact, price could have already turned up and be starting an uptrend on that long red bar. If the bar has a tail at the bottom, then the close was off the bottom. The price was actually going UP at the end of that bar. I'm thinking DOWN, but at the end of the bar the price is going UP.

     

    On the price ladder, there is no reference to the last high or low; there is no context to past price behavior. The bar on the chart is red, but on the price ladder, you see that the price is going up. Of course, you can see that on the candlestick also, but the red color and the close down may bias your perception of what the price behavior really is.

     

    Some people prefer a 1 tick chart in order to avoid these artificial constraints put on the data that may bias your perception. I have no interest in a 1 tick chart, but I can understand why someone would want to see price in it's "purest" form.

     

    I don't want a 1 tick chart, but I want to somehow try to counterbalance this possible undo bias to my perception. I also do not want to trade solely on price action. So I want to keep my charts, just understand them better.

     

    So at some point I realized that all kinds of things could be going on intrabar that I am not really consciously processing. So there was a huge hole in my understanding of price behavior. Price bars focus on the OHLC. Open, high, low and close. But those 4 data points only represent a very small section of the data. So in effect, I could be basing my decisions on just a small subset of data, and ignoring everything else. This doesn't make any sense to me. I want a more complete understanding of what is really going on.

     

    I could go to smaller and smaller aggregation periods, but that would mean more and more charts and more and more screens to monitor.

     

    Hopefully this explains my interest in intrabar behavior, and my efforts to come up with ways to process intrabar data.


  19. Here is some code to assign price high values to an array:

     

    TradeStation:

     

    
    {This code captures and records the last two intrabar highs when the close is at the high}
    
    array: IntraBarPersist CrrntHi[2](0);  // IntraBarPersist assigns value intrabar
    
    //If its the beg of a bar then reset the array values to zero
    if BarStatus(1) = 0 then begin //Bar status is first tick of bar
     CrrntHi[0] = 0;
     CrrntHi[1] = 0;
     End
    Else If Close = High then begin // When the price Close is at the price High
     CrrntHi[1] = CrrntHi[0]; //Set the second array value to the first array value
     CrrntHi[0] = High; // Set first array value to the current price high
    End;


  20. In trading, using an array is critical to compare intrabar data. Indexes can be used to compare one bar to another bar:

     

    For example:

     

    (If Close > High[1] then Sell) If the current close is greater than the last bars high, then sell.

     

    In comparison:

     

    If High > High then Sell; If this bars high is greater than this bars high then sell. This statement will never be true. You can't compare the current high to itself on the same bar using the built in price functions.

     

    If you want to compare the high of the current bar at one point in time, to the high of the current bar at another point in time, you can only do that with an array. For example, if you wanted to compare the high of the price bar when your indicator crossed a threshold, and then compare the high of the price bar when the indicator started in a new direction, and that all happened on the same price bar, you would need to store the value of the high of the bar when the indicator crossed the threshold, then capture the value of the high of the price bar when the indicator started moving the other direction, then retrieve those two values from the array in order to compare them.


  21. In trading, using an array is critical to compare intrabar data. Indexes can be used to compare one bar to another bar:

     

    For example:

     

    (If Close > High[1] then Sell) If the current close is greater than the last bars high, then sell.

     

    In comparison:

     

    If High > High then Sell; If this bars high is greater than this bars high then sell. This statement will never be true. You can't compare the current high to itself on the same bar using the built in price functions.

     

    If you want to compare the high of the current bar at one point in time, to the high of the current bar at another point in time, you can only do that with an array. For example, if you wanted to compare the high of the price bar when your indicator crossed a threshold, and then compare the high of the price bar when the indicator started in a new direction, and that all happened on the same price bar, you would need to store the value of the high of the bar when the indicator crossed the threshold, then capture the value of the high of the price bar when the indicator started moving the other direction, then retrieve those two values from the array in order to compare them.

×
×
  • Create New...

Important Information

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