How to read the FloatingPL indicator

Englewood85

New member
I'm using the built-in Stochastic strategy on the USD/GBP. I'm displaying the 1 hour chart. Here is the strategy's code:

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2013-2020
#

input priceH = high;
input priceL = low;
input priceC = close;
input kPeriod = 10;
input slowing_period = 3;
input over_bought = 80;
input over_sold = 20;
input averageType = AverageType.SIMPLE;

def fullK = reference StochasticFull("k period" = kPeriod, "price h" = priceH, "price l" = priceL, "price c" = priceC, "slowing period" = slowing_period, "average type" = averageType).FullK;

AddOrder(OrderType.BUY_AUTO, fullK crosses above over_sold, tickColor = GetColor(8), arrowColor = GetColor(8), name = "StochasticLE");
AddOrder(OrderType.SELL_AUTO, fullK crosses below over_bought, tickColor = GetColor(6), arrowColor = GetColor(6), name = "StochasticSE");

I also have the FloatingPL indicator displayed on the lower graph.

1. Some bars are light green, some are dark green. What does this signify?
2. On 09/15 at 9:00 AM, there is a sell signal. On 09/17 at 2:00 AM, there is a buy signal.
a. Is the 09/15 sell signal a sell to open or sell to close? How can you tell?
b. If the 09/15 signal is sell to open, how can there be green FloatingPL bars all the way until the 09/17 buy signal? During most of that time, the price is
higher than the 09/15 sell price, which means most of the FloatingPL bars should be red right?
c. If the 09/15 signal is sell to close, this means that there is no open position between 09/15 thru 09/17, which means there shouldn't be green or red
FloatingPL bars, but there are green bars (light and dark) present. How can this be?
 
Since you're new to backtesting strategy, the easiest way to read the signals and its P/L report is to separate buying (go long) and shorting (going short) into two different strategies.

Go long (buy to open and sell to close)

Code:
AddOrder(OrderType.BUY_TO_OPEN, fullK crosses above over_sold, tickColor = GetColor(8), arrowColor = GetColor(8), name = "StochasticLE");
AddOrder(OrderType.SELL_TO_CLOSE, fullK crosses below over_bought, tickColor = GetColor(6), arrowColor = GetColor(6), name = "StochasticSE");

Go short (sell to open and buy to close)

Code:
AddOrder(OrderType.Sell_TO_OPEN, fullK crosses above over_sold, tickColor = GetColor(8), arrowColor = GetColor(8), name = "StochasticLE");
AddOrder(OrderType.Buy_TO_CLOSE, fullK crosses below over_bought, tickColor = GetColor(6), arrowColor = GetColor(6), name = "StochasticSE");

I hope that helps.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@BenTen I tried your suggestion many times and I get the same exact performance report in each case. I tried this with EUR/USD. I changed to a new currency, then back to EUR/USD to refresh the chart just to be sure. I still get the same result using both types of code. Is there a refresh button that you're supposed to click? I noticed how the orders are opposite and I did enter it correctly.

I don't know what I'm overlooking.
 
@Englewood85 I just notice the conditions for buy and sell are the same for both scenarios. That is why the P/L reports are the same.

This should be the correct code for your short strategy.

Code:
AddOrder(OrderType.Sell_TO_OPEN, fullK crosses above over_bought, tickColor = GetColor(8), arrowColor = GetColor(8), name = "STO");
AddOrder(OrderType.Buy_TO_CLOSE, fullK crosses below over_sold, tickColor = GetColor(6), arrowColor = GetColor(6), name = "BTC");
 
Thank you. Here is my code now. This is not showing up on my chart for some reason.

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2013-2020
#

input priceH = high;
input priceL = low;
input priceC = close;
input kPeriod = 10;
input slowing_period = 3;
input over_bought = 80;
input over_sold = 20;
input averageType = AverageType.SIMPLE;

def fullK = reference StochasticFull("k period" = kPeriod, "price h" = priceH, "price l" = priceL, "price c" = priceC, "slowing period" = slowing_period, "average type" = averageType).FullK;


AddOrder(OrderType.BUY_TO_OPEN, fullK crosses above over_sold, tickColor = GetColor(8), arrowColor = GetColor(8), name = "BTC");
AddOrder(OrderType.SELL_TO_CLOSE, fullK crosses below over_bought, tickColor = GetColor(6), arrowColor = GetColor(6), name = "STO");

#AddOrder(OrderType.Sell_TO_OPEN, fullK crosses above over_bought, tickColor = GetColor(8), arrowColor = GetColor(8), name = "STO");
#AddOrder(OrderType.Buy_TO_CLOSE, fullK crosses below over_sold, tickColor = GetColor(6), arrowColor = GetColor(6), name = "BTC");
 
As far as I can tell, I do have it as a strategy. I used the same method with another strategy and that other one worked. The difference between a study and a strategy is the presence of the AddOrder( ) right? Just to be sure, what steps are you taking to add this as a strategy and not a study?
 
@Englewood85 Correct. I added it as a strategy and it works for me.

UlMAEIl.png
 
That was the mistake I was making. Your picture helped. Thank you for posting that. I was able to download performance reports. I downloaded AUTO, Buy to Open and Sell to Open. I am trying to reconcile the BTO and STO tabs with the AUTO tab.

On the EUR/USD 1 hour chart, I am trying to make sense out of the trades from 09.15.2020 - 09.17.2020.

1. For the BTO trades on these dates, I can locate them on the AUTO tab.
2. I am unable to identify a single STO trade between these dates on the AUTO tab.
3. On the AUTO tab between these dates, there are trades that I can't make sense out of.
4. I understand the Trade P/L column, but I can't make sense out of how the P/L column is calculated either.

I can't find adequate documentation that would answer my questions. Can you offer any insight into this and/or direct me to any good sources?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
293 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top