Soren test 2

Say we use strategy.risk.allow_entry_in() to only trade longs. When our script uses the strategy.entry() function to open a short trade, TradingView of course won’t allow our strategy to go short. But that doesn’t mean the trade is ignored. Instead the ‘enter short’ trade – which is actually a sell command – becomes an ‘exit long’ order.
Another way to think about this is the following. The strategy.entry() function can reverse positions: longs into shorts, and shorts into longs. That reverse behaviour gets stopped by strategy.risk.allow_entry_in(). What strategy.entry() instead ends doing is close positions: from long to flat, or from short to flat.
(The example strategies that we discuss later in this article show how strategy.risk.allow_entry_in() makes strategy.entry() close instead of open trades.)
Say we use strategy.risk.allow_entry_in() to only trade longs. When our script uses the strategy.entry() function to open a short trade, TradingView of course won’t allow our strategy to go short. But that doesn’t mean the trade is ignored. Instead the ‘enter short’ trade – which is actually a sell command – becomes an ‘exit long’ order.
Another way to think about this is the following. The strategy.entry() function can reverse positions: longs into shorts, and shorts into longs. That reverse behaviour gets stopped by strategy.risk.allow_entry_in(). What strategy.entry() instead ends doing is close positions: from long to flat, or from short to flat.
(The example strategies that we discuss later in this article show how strategy.risk.allow_entry_in() makes strategy.entry() close instead of open trades.)
Say we use strategy.risk.allow_entry_in() to only trade longs. When our script uses the strategy.entry() function to open a short trade, TradingView of course won’t allow our strategy to go short. But that doesn’t mean the trade is ignored. Instead the ‘enter short’ trade – which is actually a sell command – becomes an ‘exit long’ order.
Another way to think about this is the following. The strategy.entry() function can reverse positions: longs into shorts, and shorts into longs. That reverse behaviour gets stopped by strategy.risk.allow_entry_in(). What strategy.entry() instead ends doing is close positions: from long to flat, or from short to flat.
(The example strategies that we discuss later in this article show how strategy.risk.allow_entry_in() makes strategy.entry() close instead of open trades.)Say we use strategy.risk.allow_entry_in() to only trade longs. When our script uses the strategy.entry() function to open a short trade, TradingView of course won’t allow our strategy to go short. But that doesn’t mean the trade is ignored. Instead the ‘enter short’ trade – which is actually a sell command – becomes an ‘exit long’ order.
Another way to think about this is the following. The strategy.entry() function can reverse positions: longs into shorts, and shorts into longs. That reverse behaviour gets stopped by strategy.risk.allow_entry_in(). What strategy.entry() instead ends doing is close positions: from long to flat, or from short to flat.
(The example strategies that we discuss later in this article show how strategy.risk.allow_entry_in() makes strategy.entry() close instead of open trades.)
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả chấp thuận mới có thể truy cập tập lệnh này. Bạn sẽ cần yêu cầu và được cấp quyền sử dụng. Thông thường quyền này được cấp sau khi thanh toán. Để biết thêm chi tiết, làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với sorentin.
TradingView KHÔNG khuyến nghị bạn trả phí hoặc sử dụng một tập lệnh trừ khi bạn hoàn toàn tin tưởng vào tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm các lựa chọn miễn phí, mã nguồn mở trong các script cộng đồng của chúng tôi.
Hướng dẫn của tác giả
Thông báo miễn trừ trách nhiệm
Tập lệnh chỉ hiển thị cho người được mời
Chỉ những người dùng được tác giả chấp thuận mới có thể truy cập tập lệnh này. Bạn sẽ cần yêu cầu và được cấp quyền sử dụng. Thông thường quyền này được cấp sau khi thanh toán. Để biết thêm chi tiết, làm theo hướng dẫn của tác giả bên dưới hoặc liên hệ trực tiếp với sorentin.
TradingView KHÔNG khuyến nghị bạn trả phí hoặc sử dụng một tập lệnh trừ khi bạn hoàn toàn tin tưởng vào tác giả và hiểu cách hoạt động của tập lệnh. Bạn cũng có thể tìm các lựa chọn miễn phí, mã nguồn mở trong các script cộng đồng của chúng tôi.