Profile Picture

Sort Open Positions

Posted By pavan074 5 Years Ago
Message
Posted Tuesday December 11 2012
Good morning. Using multiple orders, for example, I would like to order the opening of the positions in order of ascending or descending Symbol.Name (or other criteria). How can I do?
Thank you Smile
Posted Wednesday December 12 2012
The easiest way to accomplish is to execute the orders in System rather than Symbol. Symbols can be accessed via SymbolScripts[symbol].Method where 'Method' is any method on SymbolScript, e.g. NewBar, NewTick, etc.

Duane

Edited: Wednesday December 12 2012 by alpha23
Posted Friday December 14 2012
Thank you very muth dwebber.


Posted Monday December 17 2012
Dear Duane, I tried as you suggested me but seems to do not work.
Infact i try to order the symbols in descending mode, but they're always ascending in the trade list results.
Here is the code:

public class MySystem : MySystemBase
{
   public List orderedSymbolScripts;   
   
   public override void NewBar()
   {      
      this.orderedSymbolScripts = (from ss in this.SymbolScripts
                      orderby ss.Symbol.Name descending
                      select ss).ToList();      
      
      foreach (MySymbolScript ss in this.orderedSymbolScripts)
      {
         this.SymbolScripts[ss.Symbol.Name].trade();
      }         
   }
   
}



public partial class MySymbolScript : MySymbolScriptBase
{   
   public void trade()
   {         
      Position pos = this.OpenPosition(setPositionSettings(PositionType.Long));               
   }      
}


Posted Monday December 17 2012
I forgot about this thread…let me know if this helps, or at least answers your question:

http://www.rightedgesystems.com/forums/Topic3632-13-1.aspx?Highlight=position+priority

Duane
Posted Tuesday December 18 2012
Thank you Duane, unfortunately I have not found the answer!
I would like to sort the list of symbols to buy. For example I would like to buy before the symbol 'B' than 'A'. It is possible to do this?
Thank you again.

Massimo
Posted Tuesday December 18 2012
Per the above post, is CreateTicksFromBars = true or false? If true, I don't believe it is supported. The issue that I was trying to solve was to sort orders and execute not based on alphabetical order, but on different criteria.

Duane
Posted Wednesday December 19 2012
Hi Duane,
i've not set CreateTicksFromBars property, so it is set by default value i think.
Thank you.

Massimo
phg
Supreme Being (48,657 reputation)Supreme Being (48,657 reputation)Supreme Being (48,657 reputation)Supreme Being (48,657 reputation)Supreme Being (48,657 reputation)Supreme Being (48,657 reputation)Supreme Being (48,657 reputation)Supreme Being (48,657 reputation)Supreme Being (48,657 reputation)
Posted Wednesday December 19 2012
I'm not quite sure I understand the situation entirely, so let me ask some questions if I may. Has this code been run in the debugger line by line? What exactly is not in the desired order? The 'trade results' list may not be in the order in which the orders were issued, if I understand what is happening.

(Don't mind me if I have gone off on a tangent --- just trying to understand in more detail. It seems like an interesting problem to solve.)

-Pete

See also Yahoo group about applying RE.

Posted Wednesday December 19 2012
Massimo,

   Please run the system in the Visual Studio debugger and let us know the value of CreateTicksFromBars. If it is true, the last indication from RightEdge is that what you are trying to do is not currently supported.

Also, what is the reason that you are trying to place order by alphabetical order? Or is there a different sort order that you are trying to accomplish? I ask because in general it is not a good idea to place sorted orders as it may not reflect a live system.

Duane


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems