Click here to Login





                                                   IFF Formula

  0

0
Rakla03
2017-09-07 05:34:12


Hi outside,

who can help me at the following:

I have a buy/sell order which works:

buy = iff(mk1 < 9 and mk3 > 8.32, stringequal(name(), "#exs1.de"), stringequal(name(), "#exx6.de"));
sell = iff(mk1 > 9 or mk3 < 8.32, stringequal(name(), "#exs1.de"), stringequal(name(), "#exx6.de"));

(The calculating of mk1 and mk3 is not important)

Instead of "#exs1.de" and "#exx6.de" I would like to buy out of a basket of 5 the best ranked 2 in roc(25)

I know the formula to rank:
rank1 = comp(roc(25), "rank");
rank2 = rank1 < 3;

But I dont know how to integrate the ranking into the Iff-formula above.

Can someone help?

THX




QuantShare
2017-09-07 18:34:10

  0

You no longer need "iff".

rank1 = comp(roc(25), "rank");
rank2 = rank1 < 3;
buy = mk1 < 9 and mk3 > 8.32 and rank2;
sell = mk1 > 9 or mk3 < 8.32;



Rakla03
2017-09-19 09:06:39

  0

I see, I didnt make it clear enough.

Instead of "#exs1.de" and "#exx6.de" I would like to buy out of TWO baskets of 5 each the best ranked 2 in roc(25)

Instead of "#exs1.de" a basket A of lets say "#exs1.de", "#exs2.de", "#exs3.de", "#exs4.de", "#exs5.de".
Instead of "#exx6.de" a basket B of lets say "#exx6.de", "#exx7.de", "#exx8.de", "#exx9.de", "#exx10.de".

So how to define at
- buy: pick out best 2 of Basket A if mk1 < 9 and mk3 > 8.32
- sell Basket A and buy best 2 out of Basket B if mk1 < 9 and mk3 > 8.32

THX



QuantShare
2017-09-19 10:24:20

  0

Try this:

filter1 = mk1 < 9 and mk3 > 8.32;
rank1 = comp(roc(25), "rank", 1, filter1, "Basket A"); // Where Basket A is a list of symbols you can create in "Symbol-> Symbols View"
rank2 = comp(roc(25), "rank", 1, !filter1, "Basket B");

buy = iff(mk1 < 9 and mk3 > 8.32, rank1 <= 2, rank2 <= 2);

// You also need to add both symbols in Basket A and B as symbols in your simulation

For the sell part, you probably need to use "isinlist(_SymbolsFilter, "Watchlist A")" within "iff" to remove any symbol in a specific list.



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Black-Scholes Option Pricing Model formula
PREV - Previous value of the same formula
Formula & Symbol Switcher
PIPS conversion formula in Forex trading
Lunar Phase Indicator - New and Full Moon Cycles

How-to Lessons
How to create a formula
How to display two stocks on the same chart
How to plot a stock using different periods in the same chart
How to create a screen
How to download and use U.S. stocks earnings data

Related Forum Threads
IFF and colors
bollinger band & rsi formula
formula use all over
guru ,Help in formula
Formula builder

Blog Posts
Working with the formula editor
QuantShare Trading Software: New Features in the 3.3.1 Version
Create Profitable Trading Strategies with Exchange Traded Funds (...
Different Types of Trading Indicators: Trend, Momentum, Volatilit...
Trading System Analysis: Backtesting report and custom measures









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.