Support Board
Date/Time: Tue, 26 Nov 2024 04:21:57 +0000
[User Discussion] - Spreadsheet system for trading question about IF
View Count: 1724
[2014-04-13 15:47:03] |
User14682 - Posts: 83 |
I am interested in writing code utalizing if. Buy example: I want to say: If this happens - AND(AA3>AG3,AA4<AG4,AG3>AC3,AG3>AE3,AG3>AI3) OR If this happens - AND(AA3>AI3,AA4<AI4,AI3>AC3,AI3>AE3,AI3>AG3) = 2 lots then let this happen - AND(AA3>AC3,AA4<AC4,AC3>AE3,AC3>AG3,AC3>AI3,AO3>AQ3) = 1 lots Any help writing this would be greatly appreciated Thnaks!!!!!!! |
[2014-04-13 16:21:29] |
Sawtooth - Posts: 4120 |
Try this (in cell J26): IF(OR(AND(AA3>AG3,AA4<AG4,AG3>AC3,AG3>AE3,AG3>AI3),AND(AA3>AI3,AA4<AI4,AI3>AC3,AI3>AE3,AI3>AG3)),2,IF(AND(AA3>AC3,AA4<AC4,AC3>AE3,AC3>AG3,AC3>AI3,AO3>AQ3),1,0)) |
[2014-04-13 16:40:57] |
User14682 - Posts: 83 |
That looks good for a buy but how would I apply the exact opposite for sale???
|
[2014-04-14 05:12:56] |
Sawtooth - Posts: 4120 |
To include conditions for a sell, you'll also need the same formula with all of the comparison operators reversed. Since this would make a huge formula, it might be easier to divide it in cells in column H, then reference those cells in J26, like this: H26: BuyA 2 lot H27: =AND(AA3>AG3,AA4<AG4,AG3>AC3,AG3>AE3,AG3>AI3) H28: BuyB 2 lot H29: =AND(AA3>AI3,AA4<AI4,AI3>AC3,AI3>AE3,AI3>AG3) H30: SellA 2 lot H31: =AND(AA3<AG3,AA4>AG4,AG3<AC3,AG3<AE3,AG3<AI3) H32: SellB 2 lot H33: =AND(AA3<AI3,AA4>AI4,AI3<AC3,AI3<AE3,AI3<AG3) H34: Buy 1 lot H35: =AND(AA3>AC3,AA4<AC4,AC3>AE3,AC3>AG3,AC3>AI3,AO3>AQ3) H36: Sell 1 lot H37: =AND(AA3<AC3,AA4>AC4,AC3<AE3,AC3<AG3,AC3<AI3,AO3<AQ3) J26: =IF(OR(H27,H29,H31,H33),2,IF(OR(H35,H37),1,0)) |
[2014-04-14 12:03:19] |
User14682 - Posts: 83 |
The original signal you provided only trades 1 lots??
|
[2014-04-14 14:20:04] |
Sawtooth - Posts: 4120 |
I am merely giving you examples of proper syntax, using formulas you provided. The efficacy of the formulas, and your system setup, is unknown to me. There is probably a more elegant way to code for Quantity, and apparently a more accurate way also. There are several things that can affect the desired functionality, and I don't have enough information to answer your question. Date Time Of Last Edit: 2014-04-14 14:42:05
|
To post a message in this thread, you need to log in with your Sierra Chart account: