My trading issues with the 1% up and 1% down seemed to keep pointing me to a previous to the expected buy or sell. The 600 second delay didn't work after a restart and forgetting for about an hour to enable the rules I still got a buy above the should be 1% higher sell.
This left me thinking that it was definitely using an older buy price and older sell prices then 10 minutes. That makes me think maybe the time isn't so important. Unfortunately my next idea wasn't successful either. I added another sell to the sell rules and another buy to the buy rules excluding the going down buy rule. This puts 2 sells in 10 minutes before the buy rule will even start. Now the odd thing is I was still able to have sells coming below my last buy (since the market was heading up). I don't know if adding a third buy would be of any help at all. I can't imagine it would do much more then delay potentially through the next range to get to its required price. Of course if it was profitable using 6% of my test amount maybe it would be better then 2 round trip trades executing upside down. If only I could divine why it was doing this.
I have increased some rules to 900 seconds or 15 minutes delay before it starts executing. I can't imagine it helping. Maybe I should only add the really big delay by delaying the start of the enables on trades that end up in a loss after. I'm still trying to get you a better answer as I can easily duplicate the issue but I can't wrap my head around why it happens.
I'm currently working to make all variables saved after restart rule and app.
Also you will able to store any data in database and view values of all variables realtime.
It will helps to understand where is issue and how to make it works.
I am a little concerned about saving the variables through a restart. Assuming they are being calculated correctly having a few calculations pulled at start up shouldn't be a huge issue. In my case I maybe shouldn't have said anything about the restart. The thing I was pondering out loud was if I restart the computer and enable the rules after the last buy and last sell printed on the tab with the orders is correct I should get a buy or a sell based on that price point. What I am at a loss for is why after so long it didn't use that price as it did clearly show a last sell that was what my actual last sell was. So since in over an hour the amount shown in the easy place to see it was "correct" but the trade price was not correct I concluded that time delays are not really a good answer for this. I then stupidly assumed since the only value that explained the trade as being "correct" was the trade preceding the last trade. This sent me wrongly it seems to the answer of just sell 2 or buy 2 and it will follow the last number before the last trade making it track off the trade I want in the first place and the second place just sets up an additional trade at the same price.
I think possibly I am not going about solving this well as until I have another (wrong) eureka moment I really can't say why it trades off very old trades some over 1 hour old for the last trade data. I'm not saying don't save it between runs just that given the delay that I had I would have needed a more then hour delay between a buy and a sell.... That would in theory make the reverse also true. So 12 round trip trades a day if the market is staying around the price it works itself into. Honestly had I not restarted I would have had another 10 minute mistake. The only difference of any importance is that it would show a mistake at over an hour. Not useful mind you as that isn't a correct trade. It does make me think starting over an hour might work but I really shouldn't need to.
The problem always shows up the same way even with 2 nearly identical buys and sells. I have a stable range and the bot does great. It will keep doing great until the market goes up or down too much. At this point I have found 0 solutions that adequately fix the problems I am having. Once the market is up triggering a buy manually will not cause a new last buy price to show up. An hour will not allow the bot to use the price that I just made viable. As soon as anything is able to sell after that buy will be whatever the price is when the sell rule is started not 1% above that buy. In effect I had hoped adding another buy would force it to use the wrong buy before the last buy value..... It really doesn't I just get 2x the mistakes. Since it does 2x as good when it wins I can't say I'm in a worse boat. I am exactly where I started. Even starting a sell and letting the buy show up under doesn't seem to fix it. The only change is what the bot is doing at the time of the mistake. If I sell first the buy will likely be correct or below the sell before that making it either profitable or even more profitable. Sounds great. Then it will (ignoring delay) get a sell immediately at whatever the price changes to on the next tick unless the buy was below the sell before the high sell I put in. At some point though that sell will be used as a last sell and then any price at least 1% below that price will be acceptable to the bot. Even if I am bothered by it suddenly buying above the last sell.....
If I gave up on the stop loss portions of the rules I generated I could expect a profit. This profit would last precisely until I have to start the bot in a new range. I then am stuck unable to fix the bot until I have some unknown amount of trade data in the new range started and executed manually until the bot can correctly discern it is actually in a range.
EDIT: I am sorry it seems I have a bad habit of not being nice when I post. I appreciate what you have done and are doing. I am more then a little concerned when my last buy on my orders page isn't 1% less then my listed last sell when the buy logic dictates it has to be at least that low to buy.
After thinking more on it today do the values of the trade logs last buy and last sell prices come from the same place the scripting engine would pull the data from?