Support Board
Date/Time: Thu, 16 Jan 2025 13:43:59 +0000
[Programming Help] - If loss, then ONLY enter in Opposite direction
View Count: 758
[2017-10-31 03:09:03] |
User606491 - Posts: 164 |
Using the spreadsheet system for trading: I would like to add a formula that says if the last trade was a "SELL" and that trade lost money, then the next trade must be a "BUY" (or cannot be a "SELL") J44: tells me profit/loss on ht prior trade J7: tells me whether the prior trade was profitable But, how do I tell SC that the next trade must be a BUY? Here's what I've got so far: if(and($j$44<0,$j$7<0),and($j$4>0,$j$5>0,$j$8>0),???) thank you. |
[2017-10-31 12:43:35] |
User29926 - Posts: 92 |
This is a quick code block. I did not test it, so your mileage may vary. You may/will need to modify it to fit your spreadsheet. **In an H cell place this code relating to a SEll: **ASSUMING THAT ITS THE $H$4 CELL =IF(AND($J$44< 0,$J$7< 0),1, IF(J$8 > 0,0,IF(ISBLANK($H$4),0,$H$4))) **In an H cell place this code relating to a BUY: **ASSUMING THAT ITS THE $H$5 CELL =IF(AND($J$44< 0,$J$7> 0),1, IF(J$8 < 0,0,IF(ISBLANK($H$5),0,$H$5))) **IN $M$3 SELL ENTRY ADD TO YOUR ENTRY CODE: $H$4=0 **IN $K$3 BUY ENTRY CELL ADD TO YOUR ENTRY CODE: $H$5=0 |
[2017-10-31 15:40:27] |
User606491 - Posts: 164 |
Makes sense to me. Thank you.
|
To post a message in this thread, you need to log in with your Sierra Chart account: