| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #41 | ||
![]() | Re: Array (EasyLanguage) when do we intrabar dont' we get the same results? COuld you explain more please? | ||
| |
|
| | #42 | ||
![]() | Re: Array (EasyLanguage) Quote:
Traders Lab - Intrabar Price Behavior
__________________ Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens. | ||
| |
|
| | #43 | ||
![]() | Re: Array (EasyLanguage) 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. Quote:
Code: 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;
__________________ Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens. | ||
| |
|
| | #44 | ||
![]() | Re: Array (EasyLanguage) Quote:
| ||
| |
|
| | #45 | ||
![]() | Re: Array (EasyLanguage) Quote:
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.
__________________ Precise, "dialed-in", targeted combination setups, like opening a combination lock; is the experience you should be having while trading. Dial left, right, left, . . . click - the lock opens. | ||
| |
|
![]() |
| Tags |
| array, easylanguage |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Buy at Open with Easylanguage | cleon | Coding Forum | 5 | 03-02-2011 11:16 AM |
| Antonio: Please help me on MP for easylanguage | nasdaq5048 | Market Profile | 13 | 09-23-2010 09:50 AM |
| Can function in TS8 return array? | ImXotep | Technical Analysis | 5 | 05-25-2009 02:13 AM |
| MT4 Indicator Array Problem. | ForexSurfr | Coding Forum | 0 | 02-16-2009 12:19 PM |
| Some EasyLanguage Help Please | jjthetrader | Coding Forum | 8 | 06-02-2008 04:20 PM |